<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1559515759987320099</atom:id><lastBuildDate>Wed, 22 Apr 2015 20:07:36 +0000</lastBuildDate><category>tech</category><category>business</category><category>english</category><category>exchange server</category><category>maths</category><category>love</category><category>entertainment</category><category>religion</category><category>sight seeing</category><category>science</category><title>Siry Blogz</title><description></description><link>http://siry-blogz.blogspot.com/</link><managingEditor>noreply@blogger.com (siry blogz)</managingEditor><generator>Blogger</generator><openSearch:totalResults>1831</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-1948232495704040471</guid><pubDate>Wed, 22 Apr 2015 19:50:00 +0000</pubDate><atom:updated>2015-04-23T01:20:48.774+05:30</atom:updated><title>Add all in one subscription box to blogger</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;header class=&quot;entry-header&quot; style=&quot;background-color: #f8f8f8; border: 0px; color: #333333; font-family: &#39;Open Sans&#39;, sans-serif; font-stretch: inherit; line-height: 21.0599994659424px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;h1 class=&quot;entry-title&quot; style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: Oswald, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: -30px 0px 18px; overflow: hidden; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Subscription box is a very popular and mostly widely used widget on all the blogs and websites. Every website on the internet whether it is a wordpress blog , blogger blog or a static html website contains its own social subscription box. This post is about the all in one social subscription box widget for blogger blogs. This subscription box contains almost all major social network integrations in it.&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/header&gt;&lt;div class=&quot;entry-content&quot; style=&quot;background-color: #f8f8f8; border: 0px; color: #333333; font-family: &#39;Open Sans&#39;, sans-serif; font-stretch: inherit; line-height: 1.62em; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;h5 style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: &#39;Yanone Kaffeesatz&#39;, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: 0px 0px 18px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;img alt=&quot;all in subscription box for blogger&quot; border=&quot;0&quot; height=&quot;341&quot; src=&quot;http://lh4.ggpht.com/-9DmnxGJwnOI/Uevzqh9akEI/AAAAAAAACKg/GhOxOjVGpp4/image%25255B5%25255D.png?imgmax=800&quot; style=&quot;border: 0px; display: block; float: none; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; height: auto; line-height: inherit; margin: 0px auto; max-width: 100%; padding: 0px; vertical-align: baseline;&quot; title=&quot;all in subscription box for blogger&quot; width=&quot;326&quot; /&gt;&lt;/h5&gt;&lt;h5 style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: &#39;Yanone Kaffeesatz&#39;, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: 0px 0px 18px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/h5&gt;&lt;h3 style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: &#39;Yanone Kaffeesatz&#39;, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: 0px 0px 18px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: bold; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Why you need social subscription box in your blog ?&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin-bottom: 24px; padding: 0px; vertical-align: baseline;&quot;&gt;Social subscription box contains all the important social network subscription option like Facebook like box, Twitter follow button, Google plus badge etc. Your blog visitors can directly follow you on your social networks by using this widget without even leaving your blog. In this way this widget helps in increasing your subscribers or followers. This increase in the number of the followers also helps in increasing your blog`s referral traffic from social networking websites. It also provide lots of exposure and popularity to your blog. so it is always a good practice to add a good subscription box to your blog.&lt;/div&gt;&lt;h3 style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: &#39;Yanone Kaffeesatz&#39;, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: 0px 0px 18px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: bold; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Features of the complete subscription box&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;ol style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px 0px 24px 30px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Compact design which consumes only a little bit space in your blog`s sidebar.&lt;/li&gt;&lt;li style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Attractive and clean CSS design.&lt;/li&gt;&lt;li style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;All major social network subscription options like facebook, twitter, RSS feeds, email subscription, Google plus badge, Google + recommend and social icons.&lt;/li&gt;&lt;li style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Lightweight JavaScript and HTML code which do not effect blog`s loading speed.&lt;/li&gt;&lt;li style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Highly compatible design with almost all major browsers.&lt;/li&gt;&lt;/ol&gt;&lt;h5 style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: &#39;Yanone Kaffeesatz&#39;, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: 0px 0px 18px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/h5&gt;&lt;h3 style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: &#39;Yanone Kaffeesatz&#39;, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: 0px 0px 18px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: bold; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Code for subscription box&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-color: #f0f0f0; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 1px solid rgb(220, 220, 205); color: #555555; font-family: Monaco, Consolas, &#39;Lucida Console&#39;, &#39;Bitstream Vera Sans Mono&#39;, monospace; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: 1.62em; margin-bottom: 24px; overflow: auto; padding: 15px; vertical-align: baseline; white-space: pre-wrap; width: 619.96875px; word-wrap: break-word;&quot;&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt; &lt;br /&gt;#wcsub-box&lt;br /&gt;{&lt;br /&gt;box-shadow:1px 1px 4px  #dcdcdc;&lt;br /&gt;-moz-box-box-shadow:1px 1px 4px  #dcdcdc;&lt;br /&gt;-web-kit-box-shadow:1px 1px 4px  #dcdcdc;&lt;br /&gt;-goog-ms-box-shadow:1px 1px 4px  #dcdcdc;&lt;br /&gt;margin-bottom:70px;&lt;br /&gt;height:264px;&lt;br /&gt;}&lt;br /&gt;#wc-socico&lt;br /&gt;{&lt;br /&gt;height:33px;&lt;br /&gt;border-bottom:1px solid #dcdcdc;&lt;br /&gt;border-left:1px solid #dcdcdc;&lt;br /&gt;border-right:1px solid #dcdcdc;&lt;br /&gt;padding:2px;&lt;br /&gt;background:#ffffff;&lt;br /&gt;}&lt;br /&gt;#wc-socicoimg&lt;br /&gt;{&lt;br /&gt;height:28px;&lt;br /&gt;width:28px;&lt;br /&gt;}&lt;br /&gt;#wc-socico table&lt;br /&gt;{&lt;br /&gt;border:none;&lt;br /&gt;}&lt;br /&gt;#wc-rscount&lt;br /&gt;{&lt;br /&gt;margin-top:2px;&lt;br /&gt;margin-right:-25px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#wcsub-box .wcsub-fblike { border-bottom: 1px solid #dcdcdc; border-left: 1px solid #dcdcdc; border-right: 1px solid #dcdcdc; padding: 5px; background:#fff;}&lt;br /&gt;  &lt;br /&gt;    #wcsub-box .twitter-follow { background: #ffffff; border-left: 1px solid #dcdcdc;border-right: 1px solid #dcdcdc; padding:5px 11px;}&lt;br /&gt;    #wcsub-box .wcsub-email {border: 1px solid #dcdcdc; background: #f8f8f8; padding:11px;}&lt;br /&gt;        #wcsub-box .wcsub-email h4{color: #444;font-family: Arial;font-size: 12px; margin: 0 0 10px;}&lt;br /&gt;        #wcsub-box .wcsub-email .txt,#wcsub-box .wcsub-email .txt:focus{background:#fff; float:left; color:#777777; border:1px solid #dcdcdc; border-radius: 3px; padding: 7px 10px 8px; width: 140px;}&lt;br /&gt;        #wcsub-box .wcsub-email .wcsub-button,#wcsub-box .wcsub-email .wcsub-button:focus{background:#222222; border:1px solid #222222; color:#fff; border-radius: 3px; float: right; font-size: 12px; font-weight: bold; padding:7px 3px; }&lt;br /&gt;            #wcsub-box .wcsub-email &lt;br /&gt;input, textarea {&lt;br /&gt;font-family: Georgia, &quot;Times New Roman&quot;, Times; font-size: 1em;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div id=&quot;wcsub-box&quot;&amp;gt;&lt;br /&gt;&amp;lt;div class=&quot;wcsub-email&quot;&amp;gt;&lt;br /&gt;&amp;lt;h4&amp;gt;Get FREE updates on your &amp;lt;a href=&quot;http://feedburner.google.com/fb/a/mailverify?uri=&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;WindroidClubblog&lt;/span&gt;&quot; target=&quot;_blank&quot; style=&quot;color:#3b5998;&quot;&amp;gt;Email&amp;lt;/a&amp;gt; | &amp;lt;a href=&quot;http://feeds.feedburner.com/&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;WindroidClubblog&lt;/span&gt;&quot; target=&quot;_blank&quot; style=&quot;color:orange;&quot;&amp;gt;RSS&amp;lt;/a&amp;gt;&amp;lt;/h4&amp;gt;&lt;br /&gt;&amp;lt;form onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;WindroidClubblog&lt;/span&gt;&#39;, &#39;popupwindow&#39;, &lt;br /&gt;&#39;scrollbars=yes,width=700px,height=700px&#39;);return true&quot; target=&quot;popupwindow&quot; method=&quot;post&quot; action=&quot;http://feedburner.google.com/fb/a/mailverify&quot;&amp;gt;&lt;br /&gt;&amp;lt;input name=&quot;email&quot; onblur=&quot;if (this.value == &#39;&#39;) {this.value = &#39;Enter your email address&#39;;}&quot; onfocus=&quot;if (this.value == &#39;Enter your email address&#39;)&lt;br /&gt;{this.value = &#39;&#39;;}&quot; value=&quot;Enter your email address&quot; class=&quot;txt&quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;uri&quot; value=&quot;&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;WindroidClubblog&lt;/span&gt;&quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&quot;hidden&quot; value=&quot;en_US&quot; name=&quot;loc&quot; /&amp;gt;&lt;br /&gt;&amp;lt;input type=&quot;submit&quot; value=&quot;Subscribe&quot; class=&quot;wcsub-button&quot; /&amp;gt;&lt;br /&gt;&amp;lt;div style=&quot;clear:both;&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div id=&quot;wc-socico&quot;&amp;gt;&lt;br /&gt;&amp;lt;table border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; width=&quot;298&quot;&amp;gt;&lt;br /&gt;&amp;lt;tbody&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;td valign=&quot;top&quot; &amp;gt;&amp;lt;a href=&#39;http://feeds.feedburner.com/&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;WindroidClubblog&lt;/span&gt;&#39; target=&#39;_blank&#39; rel=nofollow&#39; &amp;gt;&amp;lt;img id=&quot;wc-socicoimg&quot; src=&quot;http://3.bp.blogspot.com/-KjMedajdI2w/UTtUCEg5_zI/AAAAAAAABcQ/K3qUhvOTNrA/s1600/feed.png&quot; alt=&quot;Subcribe to our RSS feeds&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;td valign=&quot;top&quot; &amp;gt;&amp;lt;a href=&#39;&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;http://www.facebook.com/Windroidclub&lt;/span&gt;&#39; target=&#39;_blank&#39; rel=&#39;nofollow&#39;&amp;gt;&amp;lt;img id=&quot;wc-socicoimg&quot; src=&quot;http://2.bp.blogspot.com/-7_3aMhrvLq4/UTtUB9H5ZyI/AAAAAAAABcM/JjZGcP7r3_I/s1600/fbb.png&quot; alt=&quot;Join Us on Facebook&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;td valign=&quot;top&quot; &amp;gt;&amp;lt;a href=&#39;&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;https://plus.google.com/105802694845534710685&lt;/span&gt;&#39; target=&#39;_blank&#39; rel=&#39;nofollow&#39;&amp;gt;&amp;lt;img src=&quot;http://4.bp.blogspot.com/-vnYX9pKHZCU/UTtUCWa3-HI/AAAAAAAABcU/Xi7l4YF136U/s1600/gpp.png&quot; alt=&quot;Add to Circles&quot; id=&quot;wc-socicoimg&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;td valign=&quot;top&quot; &amp;gt;&amp;lt;a href=&#39;&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;https://twitter.com/windroidclub&lt;/span&gt;&#39; target=&#39;_blank&#39; rel=&#39;nofollow&#39;&amp;gt;&amp;lt;img id=&quot;wc-socicoimg&quot; src=&quot;http://2.bp.blogspot.com/-VXfOkCT43uI/UTtUEItlzyI/AAAAAAAABck/cvROEjW1Vx8/s1600/tww.png&quot; alt=&quot;Follow us on Twitter&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;td valign=&quot;top&quot; &amp;gt;&amp;lt;p id=&quot;wc-rscount&quot;&amp;gt;&amp;lt;a href=&quot;&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;http://feeds.feedburner.com/WindroidClubblog&lt;/span&gt;&quot; rel=&quot;nofollow&quot;&amp;gt;&amp;lt;img  src=&quot;http://feeds.feedburner.com/~fc/WindroidClubblog?bg=222222&amp;amp;fg=ffffff&amp;amp;anim=0&quot; height=&quot;26&quot; width=&quot;88&quot; style=&quot;border:0&quot; alt=&quot;&quot; /&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;div class=&quot;wcsub-fblike&quot;&amp;gt;&lt;br /&gt;   &amp;lt;iframe src=&quot;//www.facebook.com/plugins/like.php? href=&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;https://www.facebook.com/windroidclub&lt;/span&gt;&lt;/span&gt;?fref=ts &amp;amp;send=false&amp;amp;layout=button_count&amp;amp;width=80&amp;amp;show_faces=false&amp;amp;action=like&amp;amp;colorscheme=light&amp;amp;font&amp;amp;height=21&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;border:none; overflow:hidden; width:80px; height:21px;&quot; allowtransparency=&quot;true&quot;&amp;gt;&amp;lt;/iframe&amp;gt;&amp;lt;a href=&quot;&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; https://www.facebook.com/windroidclub&lt;/span&gt;&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot; style=&quot;color: #3B5998; font-family: arial; font-size: 18px; font-weight: bold; line-height: 20px;&quot;&amp;gt; Like us on Facebook &amp;lt;/a&amp;gt;&amp;lt;div class=&quot;clear&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div class=&quot;twitter-follow&quot;&amp;gt;&lt;br /&gt;  &amp;lt;a href=&quot;https://twitter.com/&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;windroidclub&lt;/span&gt;&lt;/span&gt;&quot; class=&quot;twitter-follow-button&quot;&amp;gt;Follow &lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;@Windroidclub&lt;/span&gt;&lt;/span&gt;&amp;lt;/a&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div class=&quot;wcgplus&quot;&amp;gt;&lt;br /&gt;    &amp;lt;div class=&quot;g-plus&quot; data-href=&quot;&lt;span style=&quot;border: 0px; color: red; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;https://plus.google.com/105802694845534710685&lt;/span&gt;&lt;/span&gt;&quot; data-width=&quot;290&quot; data-height=&quot;131&quot; data-theme=&quot;light&quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;h3 style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: &#39;Yanone Kaffeesatz&#39;, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 300; letter-spacing: 1px; line-height: 1.62em; margin: 0px 0px 18px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: bold; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Add subscription box to blogger&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;ul style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px 0px 24px 30px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;li style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 4px 0px 0px; padding: 0px; vertical-align: baseline;&quot;&gt;In the above code change all the red colored social network addresses with your addresses.&lt;/li&gt;&lt;li style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 4px 0px 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Copy the code.&lt;/li&gt;&lt;li style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 4px 0px 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Login to your blogger dashboard.&lt;/li&gt;&lt;li style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 4px 0px 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Select&amp;nbsp;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Layout&lt;/span&gt;&amp;nbsp;option.&lt;/li&gt;&lt;li style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 4px 0px 0px; padding: 0px; vertical-align: baseline;&quot;&gt;In your blogger Layout select&amp;nbsp;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Add a gadget&lt;/span&gt;&amp;nbsp;option&lt;/li&gt;&lt;li style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 4px 0px 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Select&amp;nbsp;&lt;span style=&quot;border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;HTML/JavaScript&lt;/span&gt;&amp;nbsp;widget&lt;/li&gt;&lt;li style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 4px 0px 0px; padding: 0px; vertical-align: baseline;&quot;&gt;In the&amp;nbsp;&lt;span style=&quot;border-image-outset: initial; border-image-repeat: initial; border-image-slice: initial; border-image-source: initial; border-image-width: initial; border: 0px; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: 600; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;HTML JavaScript&lt;/span&gt;&amp;nbsp;widget paste the above code and save the widget&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/add-all-in-one-subscription-box-to.html</link><author>noreply@blogger.com (siry blogz)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-9DmnxGJwnOI/Uevzqh9akEI/AAAAAAAACKg/GhOxOjVGpp4/s72-c/image%25255B5%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-4745027458231983241</guid><pubDate>Wed, 22 Apr 2015 18:11:00 +0000</pubDate><atom:updated>2015-04-22T23:41:12.151+05:30</atom:updated><title>READ THE TRUTH OF OUR GREAT HYDERABAD</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;background-color: white; color: #666666; font-family: helvetica, arial, &#39;lucida grande&#39;, sans-serif; font-size: 12px; line-height: 16.0799999237061px;&quot;&gt;&amp;nbsp;– SHAME ON US Do you know that the biggest cow slaughterhouse (cow killing factory) in the WORLD is located just 30 km from&lt;/span&gt;&lt;span class=&quot;text_exposed_show&quot; style=&quot;background-color: white; color: #666666; display: inline; font-family: helvetica, arial, &#39;lucida grande&#39;, sans-serif; font-size: 12px; line-height: 16.0799999237061px;&quot;&gt;&amp;nbsp;Hyderabad in rudraram village near Patancheru. It is called alkabir in 400 acres of land with high security and many of the workers are hindus.Al-Kabeer exports Pvt.Ltd. Rudraram Village, Andhra Pradesh, Patancheru, Medak, Hyderabad – 500 033.The story of Al-Kabir Hyderabad Tyranny: Don’t thinkthat these animals are killed easily and painlessly. Their agonies start along before they are dead. They are brought to Alkair in trucks, from far away distances for economy, 20-25 huge buffalos are stacked up in each truck. Nobody cares to feed themfood, or even water while in transit. They are packed so tightly in the truck, that they are hurt by each other. By the time they arrive, they are no more capable of standing on their own feet! They are moved with force of whips…They are brought into the final ground, where at leasta thousand animals are stored. This is their last openair. They are kept here for four days, hungry and thirsty. Then their legs are broken and eyes poked, so that a ‘Certificat’ can be obtained about their uselessness. The hunger and thirst of four days cause the hemoglobin to move from blood in to fat. The meat with higher hemoglobin fetches better prices.Now these animals are pushed into washing showers. Extremely hot water (200 degrees!) is sprayed on them for five minutes, to soften their skins, so they will be easy to remove. The animals faints at this point, but it is not dead yet.Now it is hung upside down with one leg, on a chain-pulley conveyor. Then half of the neck is slit. This drains the blood, but does not kill the animal. After death, the skin swells thick, which sells for a poor price. But the skin of live Animals is still thin, which has better economic value. On one side the blood is dripping from the neck, and on the other side a hole is made in stomach, from which air is pumped inside.This causes the body to swell, making it easier to peel the skin. After removing the leather, the animal is cut into four pieces: head, legs, body, and tail. Themachines remove bones, and pack small pieces of meat into cans for shipping to Alkabir’s headquartersin Hyderabad. From there it is shipped to Mumbai forexporting to its final destination.Working! Most of the people working here are Hindus. The Director, Subhash Sabarwal, is an NRI inDubai, and his brother, Satish Sabarwal, manages the plant. The other principals are Ghulam Mohammed Sheikh (Dubai), Dilip Himmat Kothari, B.N. Raman, etc. Even though the main workers on cutting machines are from Kerala and Muslims from Mumbai, the administration,security, etc. consists mainly of Hindus. There are several other equally large (or large) plants in India, owned and operated similarly by NRI’s and Arab citizens in cooperation.The people working here are paid very handsomely. This is a big attraction. A monthly salary of Rs. 50,000 to 75,000 is common. At the site, there are many vererinarians, but their job is not to save healthy live. Their only concern is to see that the meat does not carry any germs which may hurt the customers. In fact, there is a small army of government veterinarians, whose job is to see that healthy and useful animals do not get butchered. Butthese corrupt officials write false certificates according to wishes of Alkabir.You cannot easily enter Alkabir, because outside people are not allowed in there. Even the local veterinarians and police cannot go inside, so there isno question about the other local poor people even coming close to its boundaries…Security is tightened at nights with hunting dogs. Now the neighboring people do not even come close to it.Please Share Friends......&lt;/span&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/read-truth-of-our-great-hyderabad.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-8240474464901468322</guid><pubDate>Wed, 22 Apr 2015 09:37:00 +0000</pubDate><atom:updated>2015-04-22T15:07:11.742+05:30</atom:updated><title>Polymorphism in C++</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The word&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;polymorphism&lt;/b&gt;&amp;nbsp;means having many forms. Typically, polymorphism occurs when there is a hierarchy of classes and they are related by inheritance.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ polymorphism means that a call to a member function will cause a different function to be executed depending on the type of object that invokes the function.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Consider the following example where a base class has been derived by other two classes:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; width&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Parent class area :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;):&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;         cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Rectangle class area :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Triangle&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Triangle&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;):&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;         cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Triangle class area :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Main function for the program&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; rec&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Triangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  tri&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// store the address of Rectangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   shape &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;rec&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// call rectangle area.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// store the address of Triangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   shape &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;tri&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// call triangle area.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Parent&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The reason for the incorrect output is that the call of the function area() is being set once by the compiler as the version defined in the base class. This is called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;static resolution&lt;/b&gt;&amp;nbsp;of the function call, or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;static linkage&lt;/b&gt;&amp;nbsp;- the function call is fixed before the program is executed. This is also sometimes called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;early binding&lt;/b&gt;&amp;nbsp;because the area() function is set during the compilation of the program.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;But now, let&#39;s make a slight modification in our program and precede the declaration of area() in the Shape class with the keyword&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;virtual&lt;/b&gt;&amp;nbsp;so that it looks like this:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; width&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;virtual&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Parent class area :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;After this slight modification, when the previous example code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Triangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This time, the compiler looks at the contents of the pointer instead of it&#39;s type. Hence, since addresses of objects of tri and rec classes are stored in *shape the respective area() function is called.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;As you can see, each of the child classes has a separate implementation for the function area(). This is how&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;polymorphism&lt;/b&gt;&amp;nbsp;is generally used. You have different classes with a function of the same name, and even the same parameters, but with different implementations.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Virtual Function:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;virtual&lt;/b&gt;&amp;nbsp;function is a function in a base class that is declared using the keyword&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;virtual&lt;/b&gt;. Defining in a base class a virtual function, with another version in a derived class, signals to the compiler that we don&#39;t want static linkage for this function.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;What we do want is the selection of the function to be called at any given point in the program to be based on the kind of object for which it is called. This sort of operation is referred to as&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;dynamic linkage&lt;/b&gt;, or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;late binding&lt;/b&gt;.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Pure Virtual Functions:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;It&#39;s possible that you&#39;d want to include a virtual function in a base class so that it may be redefined in a derived class to suit the objects of that class, but that there is no meaningful definition you could give for the function in the base class.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;We can change the virtual function area() in the base class to the following:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; width&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// pure virtual function&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;virtual&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The = 0 tells the compiler that the function has no body and above virtual function will be called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;pure virtual function&lt;/b&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/polymorphism-in-c.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-4321090972043052509</guid><pubDate>Wed, 22 Apr 2015 09:35:00 +0000</pubDate><atom:updated>2015-04-22T15:05:45.925+05:30</atom:updated><title>C++ Overloading (Operator and Function)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ allows you to specify more than one definition for a&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;function&lt;/b&gt;&amp;nbsp;name or an&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;operator&lt;/b&gt;&amp;nbsp;in the same scope, which is called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;function overloading&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;operator overloading&lt;/b&gt;respectively.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;An overloaded declaration is a declaration that had been declared with the same name as a previously declared declaration in the same scope, except that both declarations have different arguments and obviously different definition (implementation).&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When you call an overloaded&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;function&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;operator&lt;/b&gt;, the compiler determines the most appropriate definition to use by comparing the argument types you used to call the function or operator with the parameter types specified in the definitions. The process of selecting the most appropriate overloaded function or operator is called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;overload resolution&lt;/b&gt;.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Function overloading in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. You can not overload function declarations that differ only by return type.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the example where same function&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;print()&lt;/b&gt;&amp;nbsp;is being used to print different data types:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; printData &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;        cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Printing int: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  f&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;        cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Printing float: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; f &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;        cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Printing character: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; c &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   printData pd&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Call print to print integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   pd&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Call print to print float&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   pd&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;500.263&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Call print to print character&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   pd&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Hello C++&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Printing&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Printing&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;500.263&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Printing&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; character&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; C&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;++&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Operators overloading in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You can redefine or overload most of the built-in operators available in C++. Thus a programmer can use operators with user-defined types as well.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Overloaded operators are functions with special names the keyword operator followed by the symbol for the operator being defined. Like any other function, an overloaded operator has a return type and a parameter list.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;operator&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;);&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;declares the addition operator that can be used to&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;add&lt;/b&gt;&amp;nbsp;two Box objects and returns final Box object. Most overloaded operators may be defined as ordinary non-member functions or as class member functions. In case we define above function as non-member function of a class then we would have to pass two arguments for each operand as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;operator&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;);&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the example to show the concept of operator over loading using a member function. Here an object is passed as an argument whose properties will be accessed using this object, the object which will call this operator can be accessed using&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;this&lt;/b&gt;&amp;nbsp;operator as explained below:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; getVolume&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; breadth &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; setLength&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; len &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;          length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; len&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; setBreadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; bre &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;          breadth &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; bre&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; setHeight&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; hei &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;          height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; hei&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Overload + operator to add two Box objects.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;operator&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;breadth &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;breadth &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;breadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; length&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Length of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; breadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Breadth of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Height of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Main function for the program&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Declare Box1 of type Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Declare Box2 of type Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;                &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Declare Box3 of type Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Store the volume of a box here&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// box 1 specification&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setLength&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;6.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setBreadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;7.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setHeight&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// box 2 specification&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setLength&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;12.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setBreadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;13.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setHeight&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// volume of box 1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;getVolume&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Volume of Box1 : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// volume of box 2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;getVolume&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Volume of Box2 : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Add two object as follows:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box3&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// volume of box 3&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;getVolume&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Volume of Box3 : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Volume&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;210&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Volume&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1560&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Volume&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box3&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5400&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Overloadable/Non-overloadableOperators:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the list of operators which can be overloaded:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;16.6%&quot;&gt;+&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;16.6%&quot;&gt;-&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;16.6%&quot;&gt;*&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;16.6%&quot;&gt;/&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;16.6%&quot;&gt;%&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;16.6%&quot;&gt;^&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;|&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;~&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;!&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;,&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;=&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;++&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;--&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;&amp;lt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;==&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;!=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;&amp;amp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;||&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;+=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;-=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;/=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;%=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;^=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;=&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;|=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;*=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;&amp;lt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;&amp;gt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;[]&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;()&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;-&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;-&amp;gt;*&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;new&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;new []&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;delete&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;delete []&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the list of operators, which can not be overloaded:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;::&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;.*&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;?:&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 id=&quot;examples&quot; style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Operator Overloading Examples:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Here are various operator overloading examples to help you in understanding the concept.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;5%&quot;&gt;S.N.&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Operators and Example&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/unary_operators_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Unary operators overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/binary_operators_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Binary operators overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/relational_operators_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Relational operators overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;4&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/input_output_operators_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Input/Output operators overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;5&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/increment_decrement_operators_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;++ and -- operators overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;6&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/assignment_operators_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Assignment operators overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;7&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/function_call_operator_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Function call () operator overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;8&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/subscripting_operator_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Subscripting [] operator overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;9&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/class_member_access_operator_overloading.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #016c22; font-weight: bold; outline-offset: -2px; outline: -webkit-focus-ring-color auto 5px; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Class member access operator -&amp;gt; overloading&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-overloading-operator-and-function.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-7551263768986287815</guid><pubDate>Wed, 22 Apr 2015 09:33:00 +0000</pubDate><atom:updated>2015-04-22T15:03:42.769+05:30</atom:updated><title>C++ Inheritance</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;One of the most important concepts in object-oriented programming is that of inheritance. Inheritance allows us to define a class in terms of another class, which makes it easier to create and maintain an application. This also provides an opportunity to reuse the code functionality and fast implementation time.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When creating a class, instead of writing completely new data members and member functions, the programmer can designate that the new class should inherit the members of an existing class. This existing class is called the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;base&lt;/b&gt;&amp;nbsp;class, and the new class is referred to as the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;derived&lt;/b&gt;&amp;nbsp;class.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The idea of inheritance implements the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;is a&lt;/b&gt;&amp;nbsp;relationship. For example, mammal IS-A animal, dog IS-A mammal hence dog IS-A animal as well and so on.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Base &amp;amp; Derived Classes:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A class can be derived from more than one classes, which means it can inherit data and functions from multiple base classes. To define a derived class, we use a class derivation list to specify the base class(es). A class derivation list names one or more base classes and has the form:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; derived&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; access&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;specifier &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;base&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Where access-specifier is one of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public, protected,&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;, and base-class is the name of a previously defined class. If the access-specifier is not used, then it is private by default.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Consider a base class&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Shape&lt;/b&gt;&amp;nbsp;and its derived class&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Rectangle&lt;/b&gt;&amp;nbsp;as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Base class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; setWidth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; setHeight&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; h&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; h&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; width&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Derived class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; getArea&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setWidth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setHeight&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Print the area of the object.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Total area: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;getArea&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Total&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;35&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Access Control and Inheritance:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A derived class can access all the non-private members of its base class. Thus base-class members that should not be accessible to the member functions of derived classes should be declared private in the base class.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;We can summarize the different access types according to who can access them in the following way:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;Access&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;public&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;protected&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;25%&quot;&gt;private&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Same class&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;yes&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;yes&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;yes&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Derived classes&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;yes&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;yes&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Outside classes&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;yes&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;no&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;no&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A derived class inherits all base class methods with the following exceptions:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Constructors, destructors and copy constructors of the base class.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Overloaded operators of the base class.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The friend functions of the base class.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Type of Inheritance:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When deriving a class from a base class, the base class may be inherited through&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public, protected&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;&amp;nbsp;inheritance. The type of inheritance is specified by the access-specifier as explained above.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;We hardly use&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;&amp;nbsp;inheritance, but&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;&amp;nbsp;inheritance is commonly used. While using different type of inheritance, following rules are applied:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Public Inheritance:&lt;/b&gt;&amp;nbsp;When deriving a class from a&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;&amp;nbsp;base class,&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;members of the base class become&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;&amp;nbsp;members of the derived class and&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;members of the base class become&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;members of the derived class. A base class&#39;s&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;&amp;nbsp;members are never accessible directly from a derived class, but can be accessed through calls to the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;members of the base class.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Protected Inheritance:&lt;/b&gt;&amp;nbsp;When deriving from a&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;base class,&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;&amp;nbsp;and&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&amp;nbsp;&lt;/b&gt;members of the base class become&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;members of the derived class.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Private Inheritance:&lt;/b&gt;&amp;nbsp;When deriving from a&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;&amp;nbsp;base class,&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;&amp;nbsp;and&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;members of the base class become&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;&amp;nbsp;members of the derived class.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Multiple Inheritances:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A C++ class can inherit members from more than one class and here is the extended syntax:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; derived&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; access baseA&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; access baseB&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;....&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Where access is one of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public, protected,&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;&amp;nbsp;and would be given for every base class and they will be separated by comma as shown above. Let us try the following example:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Base class Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; setWidth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; w&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; setHeight&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; h&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; h&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; width&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Base class PaintCost&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;PaintCost&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; getCost&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;70&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Derived class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;PaintCost&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; getArea&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;width &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setWidth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;setHeight&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   area &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;getArea&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Print the area of the object.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Total area: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;getArea&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Print the total cost of painting&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Total paint cost: $&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Rect&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;getCost&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Total&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;35&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Total&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; paint cost&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; $2450&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-inheritance.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-4232950314409139982</guid><pubDate>Wed, 22 Apr 2015 09:05:00 +0000</pubDate><atom:updated>2015-04-22T14:35:29.290+05:30</atom:updated><title>The Hour of God: Man as a Transitional Being</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Man is a transitional being; he is not final. For in man and high beyond him ascend the radiant degrees that to a&amp;nbsp;&lt;em&gt;&lt;strong&gt;divine supermanhood&lt;/strong&gt;&lt;/em&gt;. There lies our destiny and the liberating key to our aspiring but troubled and limited mundane existence.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;We mean by man mind imprisoned in a living body. But mind is not the highest possible power of consciousness, for mind is not in possession of Truth, but only its ignorant seeker. Beyond mind is a supramental or gnostic power of consciousness that is in eternal possession of Truth. This supermind is at its source the dynamic consciousness, in its nature at once and inseparably infinite wisdom and infinite will of the divine Knower and Creator. Supermind is superman; a gnostic supermanhood is the next distinct and triumphant evolutionary step to be reached by earthly nature.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The step from&lt;em&gt;&lt;strong&gt;&amp;nbsp;man to superman&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;is the next approaching achievement in the&amp;nbsp;&lt;em&gt;&lt;strong&gt;earth’s evolution.&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;It is inevitable because it is at once the intention of the inner Spirit and the logic of Nature’s process.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The appearance of a human possibility in a material and animal world was the first glint of some coming divine Light, the first far-off promise of a godhead to be born out of Matter. The appearance of the&amp;nbsp;&lt;em&gt;&lt;strong&gt;superman in the human world&lt;/strong&gt;&lt;/em&gt;will be the fulfilment of this divine promise. Out of the material consciousness in which our mind works as a chained slave is emerging the disk of a secret sun of&amp;nbsp;&lt;em&gt;&lt;strong&gt;Power and Joy and Knowledge&lt;/strong&gt;&lt;/em&gt;. The supermind will be the formed body of that radiant effulgence.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Supermanhood is not man climbed to his own natural zenith, not a superior degree of human greatness, knowledge, power, intelligence, will, character, genius, dynamic force, saintliness, love, purity or perfection. Supermind is something beyond mental man and his limits; it is a greater consciousness than the&amp;nbsp;&lt;em&gt;&lt;strong&gt;highest consciousness&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;proper to human nature.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;img alt=&quot;human mind expansion&quot; class=&quot;alignright size-medium wp-image-24732&quot; height=&quot;300&quot; src=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/04/galaxy-mind-300x300.jpg&quot; style=&quot;-webkit-user-select: none; border: 0px; display: inline; float: right; height: auto; margin-bottom: 15px; margin-left: 10px; margin-top: 4px; max-width: 100%; vertical-align: middle;&quot; width=&quot;300&quot; /&gt;Man is a mental being whose mentality works here involved, obscure and degraded in a physical brain. Even in the highest of his kind it is baulked of its luminous possibilities of supreme force and freedom by this dependence, shut off even from its own divine Powers, impotent to change our life beyond certain narrow and precarious limits; it is an imprisoned and checked force, most often nothing but a servitor or caterer of interests or a purveyor of amusement to the life and the body. But divine superman will be a gnostic spirit. Supermind in him will lay hands on the mental and physical instruments and, standing above and yet Penetrating our lower already manifested parts, it will transform mind, life and body.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Mind is the highest force in man. But mind in man is an ignorant, clouded and struggling power. And even when most luminous it is possessed only of a thin, reflected and pallid light. A supermind free, master, expressive of divine glories will be the superman’s central instrument. Its untrammelled movement of self-existent knowledge, spontaneous power and untainted delight will impress the&amp;nbsp;&lt;em&gt;&lt;strong&gt;harmony of the life of the gods&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;on the earthly existence.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Man in himself is little more than an ambitious nothing. He is a littleness that reaches to a wideness and a grandeur that are beyond him, a dwarf enamoured of the heights. His mind is a dark ray in the splendours of the universal Mind. His life is a striving, exulting, suffering, an eager passion-tossed and sorrow-stricken or a blindly and dumbly longing petty moment of the universal Life. His body is a labouring perishable speck in the material universe. This cannot be the end of the mysterious up¬ward surge of Nature. There is something beyond, something that mankind shall be; it is seen now only in broken glimpses through rifts in the great wall of limitations that deny its possibility and existence. An&lt;em&gt;&lt;strong&gt;immortal soul&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;is somewhere within him and gives out some sparks of its presence; above an eternal spirit overshadows him and upholds the soul-continuity of his nature.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;But this greater spirit is obstructed from descent by the hard lid of his constructed personality; and that inner luminous soul is wrapped, stifled, oppressed in dense outer coatings. In all but a few the soul is seldom active, in most hardly perceptible. The&amp;nbsp;soul and spirit in man seem rather to exist above and behind his nature than to be a part of his external and visible reality. They are in course of birth rather than born in Matter; they are for&lt;em&gt;&lt;strong&gt;&amp;nbsp;human consciousness&lt;/strong&gt;&lt;/em&gt;possibilities rather than things realised and present.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Man’s greatness is not in what he is, but in what he makes possible. His glory is that he is the closed place and secret workshop of a living labour in which supermanhood is being made ready by a divine Craftsman. But he is admitted too to a yet greater greatness and it is this that, allowed to be unlike the lower creation, he is partly an artisan of this divine change; his conscious assent, his consecrated will and participation are needed that into his body may descend the glory that will replace him.&amp;nbsp;&lt;em&gt;&lt;strong&gt;His aspiration is earth’s call to the supramental creator.&lt;/strong&gt;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;If earth calls and the Supreme answers, the hour can be even now for that immense and glorious transformation.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;But what shall be the gain to be won for the Earth-consciousness we embody by this unprecedented ascent from mind to supermind and what the ransom of the supramental change? To what end should man leave his safe human limits for this hazardous adventure?&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;First consider what was gained when Nature passed from the brute inconscience and inertia of what seems inanimate Matter to the vibrant awakening of sensibility of plant range.&amp;nbsp;&lt;em&gt;&lt;strong&gt;Life was gained;&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;the gain was the first beginnings of a mite groping and involved, reaching a consciousness that stretches out dumbly for growth, towards sense vibration, to a preparation for vital yearnings, a living joy and beauty. The plant achieved a first form of life but could not possess it, because this first organised life-consciousness had feeling and seeking but blind, dumb, deaf, chained to the soil and was involved in its own nerve and tissue; it could not get out of them, could not get behind its nerve self as does the vital mind of the animal; still less could it turn down from above upon it to know and realise and control its own motions as does the observing and thinking mind in man. This was an imprisoned gain, for there was still a gross oppression of the first Inconscience which had covered up with the brute phenomenon of&amp;nbsp;&lt;em&gt;&lt;strong&gt;Matter and of Energy of Matter&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;all signs of the&amp;nbsp;Spirit. Nature could in no wise stop here, because she held much in her that was still occult, potential, unexpressed, unorganised, latent; the evolution had perforce to go farther. The animal had to replace the plant at the head and top of Nature.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;And what then was gained when Nature passed from the obscurity of the plant kingdom to the&amp;nbsp;&lt;em&gt;&lt;strong&gt;awakened sense, desire and emotion and the free mobility&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;of animal life? The gain was liberated sense and feeling and desire and courage and cunning and the contrivance of the objects of desire, passion and action and hunger and battle and conquest and the sex-call and play and pleasure, and all the joy and pain of the conscious living creature. Not only the life of the body which the animal has in common with the plant but a life-mind that appeared for the first time in the earth-story and grew from form to more organised form till it reached in the best the limit of its own formula.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; float: left; font-family: helvetica; font-size: 15px; line-height: 25px; margin: 10px 10px 10px 0px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The animal achieved a first form of mind, but could not possess it, because this first organised&amp;nbsp;&lt;em&gt;&lt;strong&gt;mind-consciousness&lt;/strong&gt;&lt;/em&gt;was enslaved to a narrow scope, tied to the full functioning of the physical body and brain and nerve, tied to serve the physical life and its desires and needs and passions, limited to the insistent uses of the vital urge, to material longing and feeling and action, bound in its own inferior instrumentation, its spontaneous combinings of association and memory and instinct. It could not get away from them, could not get behind them as man’s intelligence gets behind them to observe them; still less could it turn down on them from above as do human reason and will to control, enlarge, re-order, exceed, sublimate.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;At each capital step of Nature’s ascent there is a&amp;nbsp;&lt;em&gt;&lt;strong&gt;reversal of consciousness&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;in the evolving spirit. As when a climber turns on a summit to which he has laboured and looks down with an exalted and wider power of vision on all that was once above or on a level with him but is now below his feet, the evolutionary being not only transcends his past self, his former now exceeded status, but commands from a higher grade of self-experience and vision, with a new apprehending feeling or a new comprehending sight and effectuating power in a greater system of values, all that was once his own consciousness but is now below him and belongs to an inferior creation. This reversal is the sign of a&amp;nbsp;decisive victory and the seal of a radical progress in Nature.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The new consciousness attained in the spiritual evolution is always higher in grade and power, always larger, more comprehensive, wider in sight and feeling, richer and finer in faculties, more complex, organic, dominating than the consciousness that was once our own but is now left behind us. There are greater breadth and space, heights before impassable, unexpected depths and intimacies. There is a luminous expansion that is the very sign-manual of the Supreme upon his work.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Mark that each of the great radical steps forward already taken by Nature has been infinitely greater in its change, incalculably vaster in its consequences than its puny predecessor. There is a miraculous opening to an always richer and wider expression, there is a new illuminating of the creation and a dynamic heightening of its significances. There is in this world we live in no equality of all on a flat level, but a hierarchy of&amp;nbsp;&lt;em&gt;&lt;strong&gt;ever-increasing precipitous superiorities&lt;/strong&gt;&lt;/em&gt;pushing their mountain shoulders upwards towards the Supreme.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Because man is a mental being, he naturally imagines that mind is the one great leader and actor and creator or the indispensable agent in the universe. But this is an error; even for knowledge mind is not the only or the greatest possible instrument, the one aspirant and discoverer. Mind is a clumsy interlude between Nature’s vast and precise subconscient action and the vaster infallible superconscient action of the Godhead.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;img alt=&quot;superhuman&quot; class=&quot;alignright size-medium wp-image-24733&quot; height=&quot;169&quot; src=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/04/Space-Eye-300x169.jpg&quot; style=&quot;-webkit-user-select: none; border: 0px; display: inline; float: right; height: auto; margin-bottom: 15px; margin-left: 10px; margin-top: 4px; max-width: 100%; vertical-align: middle;&quot; width=&quot;300&quot; /&gt;There is nothing mind can do that cannot be better done in the mind’s immobility and thought-free stillness.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;em&gt;&lt;strong&gt;When mind is still, then Truth gets her chance to be heard in the purity of the silence.&lt;/strong&gt;&lt;/em&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Truth cannot be attained by the Mind’s thought but only by&amp;nbsp;&lt;em&gt;&lt;strong&gt;identity and silent vision.&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;Truth lives in the calm wordless Light of the eternal spaces; she does not intervene in the noise and cackle of logical debate.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Thought in the mind can at most be Truth’s brilliant and transparent garment; it is not even her body. Look through the robe, not at it and you may see some hint of her form. There can be a thought-body of Truth, but that is the&lt;em&gt;&lt;strong&gt;spontaneous supramental Thought a&lt;/strong&gt;&lt;/em&gt;nd Word that leap fully formed out of the&amp;nbsp;Light, not any difficult mental counterfeit and patchwork. The Supramental Thought is not a means of arriving at Truth, but a way of expressing her; for Truth in the Supermind is self-found or self-existent. It is an arrow from the Light, not a bridge to reach it.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Cease inwardly from thought and word, be motionless within you, look upward into the light and outward into the vast cosmic consciousness that is around you. Be more and more one with the brightness and the vastness. Then will Truth dawn on you from above and flow in you from all around you.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;But only if the mind is no less intense in its purity than its silence. For in an impure mind the silence will soon fill with misleading lights and false voices, the echo or sublimation of its own vain conceits and opinions or the response to its secret pride, vanity, ambition, lust, greed or desire. The Titans and the Demons will speak to it more readily than the divine Voices.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;em&gt;&lt;strong&gt;Silence is indispensable,&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;but also there is needed wideness. If the mind is not silent, it cannot receive the lights and voices of the supernal Truth or receiving mixes with them its own flickering tongues and blind pretentious babble. Active, arrogant, noisy it distorts and disfigures what it receives. If it is not wide, it cannot house the effective power and creative force of the Truth. Some light may play there but it becomes narrow, confined and sterile: the Force that is descending is cabined and thwarted and withdraws again to its vast heights from this rebellious foreign plane. Or even if something comes down and remains it is a pearl in the mire; for no change takes place in the nature or else there is formed only a thin intensity that points narrowly upward to the summits, but can hold little and diffuse less upon the world around it.&lt;/div&gt;&lt;h2 style=&quot;background-color: white; color: #cd1713; font-family: &#39;Open Sans&#39;, &#39;Franklin Gothic Medium&#39;, &#39;Arial Narrow Bold&#39;, Arial, sans-serif; font-size: 21px; font-weight: bolder !important; line-height: 31.5px; margin: 0px 0px 0.3em; text-align: justify; text-rendering: optimizelegibility;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;The Seven Suns of the Supermind&lt;/span&gt;&lt;/h2&gt;&lt;ol style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;&lt;strong&gt;The Sun of Supramental Truth:&amp;nbsp;&lt;/strong&gt;Knowledge-Power originating the supramental creation. Descent into the Sahasradala.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;&lt;strong&gt;The Sun of Supramental Light and Will-Power:&amp;nbsp;&lt;/strong&gt;Transmitting the Knowledge-Power as dynamic vision and command to create, found and organise the supramental creation. Descent into the Ajna Chakra, the centre between the eyes.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;&lt;strong&gt;The Sun of Supramental Word:&amp;nbsp;&lt;/strong&gt;Embodying the Knowledge-Power, empowered to express and arrange the supramental creation. Descent into the Throat Centre.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;&lt;strong&gt;The Sun of Supramental Love, Beauty, and Bliss:&amp;nbsp;&lt;/strong&gt;Releasing the Soul of the Knowledge-Power to vivify and harmonise the supramental creation. Descent into the Heart-Lotus.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;&lt;strong&gt;The Sun of Supramental Force:&lt;/strong&gt;&amp;nbsp;Dynamised as a power and source of life to support the supramental creation. Descent into the Navel Centre.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;&lt;strong&gt;The Sun of Life-Radiances (Power-Rays):&lt;/strong&gt;&amp;nbsp;Distributing the dynamis and pouring it into concrete formations. Descent into the Navel Centre.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;&lt;strong&gt;The Sun of Supramental Substance-Energy and Form-Energy:&lt;/strong&gt;&amp;nbsp;Empowered to embody the supramental life and stabilise the creation. Descent into the Muladhara.&lt;/li&gt;&lt;/ol&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;span style=&quot;color: #666699;&quot;&gt;&lt;em&gt;&amp;nbsp;~ Sri Aurobindo, excerpted from the book, “The Hour of G&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/the-hour-of-god-man-as-transitional.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-4847944765164811467</guid><pubDate>Wed, 22 Apr 2015 08:20:00 +0000</pubDate><atom:updated>2015-04-22T13:50:36.085+05:30</atom:updated><title>Kalavantin Durg: World’s most dangerous fort</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Located at an elevation of 2,300 feet in the Western Ghats near Mumbai, the Kalavantin Durg is a truly amazing feat that was used as a&amp;nbsp;&lt;em&gt;&lt;strong&gt;watch tower&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;in the past.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;As one of the 23 forts that were handed over to the Mughal Empire by Shivaji according to the&amp;nbsp;&lt;em&gt;&lt;strong&gt;Treaty of Purandar&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;in 1665, it was later reclaimed by the Maratha forces in 1667.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The fort is believed to be built around the time of&amp;nbsp;&lt;em&gt;&lt;strong&gt;Buddha&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;or approximately around 500 BC for a queen named&lt;em&gt;&lt;strong&gt;Kalavantin&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;whose story seems to have been lost in the mist of time.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;One of its most&amp;nbsp;&lt;em&gt;&lt;strong&gt;impressive features&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;is the steps leading up to the fort that were cut into the rock of the hill with such perfection.&amp;nbsp; There are no railings on the edge and no ropes on the wall to support the climb, which makes the climb down pretty tough to handle if one suffers from vertigo.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; float: left; font-family: helvetica; font-size: 15px; line-height: 25px; margin: 10px 10px 10px 0px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The steps up to the peak are almost a&amp;nbsp;&lt;em&gt;&lt;strong&gt;three hour climb&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;while getting to the fort is yet another challenge to face, recommended only for the experienced trekkers.&amp;nbsp; However, once at the summit, the panoramic view is breathtaking and one easily forgets the climb or the throbbing body ache&amp;nbsp;as the entire valley unfolds in front of you!&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Not only the city of Mumbai can be viewed from here but also other forts like Peb, Chanderi, Materan, Karnala and Ershai are a sight to see.&amp;nbsp; Accessible from&amp;nbsp;&lt;em&gt;&lt;strong&gt;Mumbai-Pune Expressway&lt;/strong&gt;&lt;/em&gt;, the fort is a main&amp;nbsp;&lt;em&gt;&lt;strong&gt;tourist attraction&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;and it no longer holds any military significance as was the original intent.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;On every&amp;nbsp;&lt;em&gt;&lt;strong&gt;Shimga Festival&lt;/strong&gt;&lt;/em&gt;&amp;nbsp;of Holi, locals from Machi-Prabal Village dance on top of the fort and they consider it a part of their culture and heritage.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Kalavantin Durg’s location and treacherous steps up to the top have given it the rightly deserved reputation of being the&lt;em&gt;&lt;strong&gt;most dangerous&lt;/strong&gt;&amp;nbsp;&lt;/em&gt;fort in the world.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px;&quot;&gt;&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;600&quot; src=&quot;https://www.youtube.com/embed/VDYIKUZNuVA?rel=0&amp;amp;controls=0&amp;amp;showinfo=0&quot; style=&quot;border-width: 0px; max-width: 100%; padding: 0px;&quot; width=&quot;800&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; float: none; font-family: helvetica; font-size: 15px; line-height: 25px; margin: 0px; text-align: center;&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;gallery galleryid-22277 gallery-columns-1 gallery-size-large&quot; id=&quot;gallery-2&quot; style=&quot;-webkit-text-stroke-width: 0px; background-color: white; color: black; font-family: helvetica; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 25px; margin: auto; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px;&quot;&gt; &lt;dl class=&quot;gallery-item&quot; style=&quot;float: left; margin: 10px 0px 0px; text-align: center; width: 795px;&quot;&gt;&lt;dt class=&quot;gallery-icon landscape&quot; style=&quot;font-weight: bold; line-height: 20px;&quot;&gt;&lt;a data-slb-active=&quot;1&quot; data-slb-group=&quot;22277&quot; data-slb-internal=&quot;0&quot; href=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/02/kalavantin-photo-gallery.jpg&quot; style=&quot;color: #fe4e47; outline: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;kalavantin-photo-gallery&quot; class=&quot;attachment-large&quot; height=&quot;768&quot; src=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/02/kalavantin-photo-gallery-1024x768.jpg&quot; style=&quot;-webkit-user-select: none; border: 2px solid rgb(207, 207, 207); height: auto; max-width: 100%; vertical-align: middle;&quot; width=&quot;1024&quot; /&gt;&lt;/a&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;div style=&quot;color: black; font-family: helvetica; font-size: 15px; font-weight: normal; margin: 0px 0px 15px;&quot;&gt;&lt;br style=&quot;clear: both;&quot; /&gt;&lt;/div&gt;&lt;dl class=&quot;gallery-item&quot; style=&quot;float: left; margin: 10px 0px 0px; text-align: center; width: 795px;&quot;&gt;&lt;dt class=&quot;gallery-icon landscape&quot; style=&quot;font-weight: bold; line-height: 20px;&quot;&gt;&lt;a data-slb-active=&quot;1&quot; data-slb-group=&quot;22277&quot; data-slb-internal=&quot;0&quot; href=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/02/image048.jpg&quot; style=&quot;color: #fe4e47; outline: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;image048&quot; class=&quot;attachment-large&quot; height=&quot;768&quot; src=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/02/image048-1024x768.jpg&quot; style=&quot;-webkit-user-select: none; border: 2px solid rgb(207, 207, 207); height: auto; max-width: 100%; vertical-align: middle;&quot; width=&quot;1024&quot; /&gt;&lt;/a&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;div style=&quot;color: black; font-family: helvetica; font-size: 15px; font-weight: normal; margin: 0px 0px 15px;&quot;&gt;&lt;br style=&quot;clear: both;&quot; /&gt;&lt;/div&gt;&lt;dl class=&quot;gallery-item&quot; style=&quot;float: left; margin: 10px 0px 0px; text-align: center; width: 795px;&quot;&gt;&lt;dt class=&quot;gallery-icon landscape&quot; style=&quot;font-weight: bold; line-height: 20px;&quot;&gt;&lt;a data-slb-active=&quot;1&quot; data-slb-group=&quot;22277&quot; data-slb-internal=&quot;0&quot; href=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/02/kalavantin-durg-32.jpg&quot; style=&quot;color: #fe4e47; outline: 0px; text-decoration: none;&quot;&gt;&lt;img alt=&quot;kalavantin-durg-3[2]&quot; class=&quot;attachment-large&quot; height=&quot;444&quot; src=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2015/02/kalavantin-durg-32.jpg&quot; style=&quot;-webkit-user-select: none; border: 2px solid rgb(207, 207, 207); height: auto; max-width: 100%; vertical-align: middle;&quot; width=&quot;790&quot; /&gt;&lt;/a&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;div style=&quot;color: black; font-family: helvetica; font-size: 15px; font-weight: normal; margin: 0px 0px 15px;&quot;&gt;&lt;br style=&quot;clear: both;&quot; /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/kalavantin-durg-worlds-most-dangerous.html</link><author>noreply@blogger.com (siry blogz)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://img.youtube.com/vi/VDYIKUZNuVA/default.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-4816086813886331209</guid><pubDate>Wed, 22 Apr 2015 08:19:00 +0000</pubDate><atom:updated>2015-04-22T13:49:20.140+05:30</atom:updated><title>Buddha’s discourse on the end of the world</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Many religions predict the end of the world. According to Hinduism, at the end of each cycle of creation. which spans billions of years, Brahman in his aspect as Rudra will destroy the worlds and withdraws them into himself. According to Christianity the world will come to an end through a series of cataclysmic events followed by resurrection of departed souls and judgment day.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;According to Vedic tradition, Aditi is mother of eight Adityas or solar deities (suns). At the end of creation these eight suns will shine together in the skies. In the following sermon, the Buddha speaks of how seven suns will appear in the sky and how the planet earth will eventually be destroyed, after many hundreds and thousands of years, through a series of cataclysmic events which are described below.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; float: right; font-family: helvetica; font-size: 15px; line-height: 25px; margin: 5px 0px 5px 5px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: disc; margin: 0px; padding: 0px;&quot;&gt;The earth will suffer from a severe drought due to lack of rains. All vegetation and life forms will disappear and vanish from the planet.&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: disc; margin: 0px; padding: 0px;&quot;&gt;A second sun will appear in the horizon, resulting in the evaporation of many streams and ponds.&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: disc; margin: 0px; padding: 0px;&quot;&gt;A third sun will appear resulting in the evaporation of many great rivers like the Ganges.&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: disc; margin: 0px; padding: 0px;&quot;&gt;After a long lapse of time, a fourth sun will appear in the sky resulting in the evaporation of great lakes.&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: disc; margin: 0px; padding: 0px;&quot;&gt;After another long lapse of time, a fifth sun will appear and the oceans will dry up slowly till they will become a finger deep.&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: disc; margin: 0px; padding: 0px;&quot;&gt;After another long lapse of time, a sixth sun will appear. The earth crust and core will heat up to intense temperatures resulting in many volcanic explosions, scorched earth and smoke filled skies.&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: disc; margin: 0px; padding: 0px;&quot;&gt;After another vast interval, a seventh sun will appear. The earth will become a fiery ball of flame and expand. Its flames will spread far and wide. Finally it will explode and disappear altogether.&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The manner in which the Buddha predicted the end of the earth sounds very much like a modern scientific theory on the destruction of planets and the entire solar system. The Buddha also clearly mentions that all life forms will vanish before the appearance of the second sun. Thereafter the earth will be a dead planet ready for its eventual destruction.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The seven suns mentioned in the discourse probably are various planets of the solar system that would become hot and shine like stars due to some changes in the activity of the sun or its gravitational force.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The manner in which the drying up of the planet earth is described reminds one of the greenhouse effect and the events that might have happened on planets like Mars which had once oceans and rivers and probably life forms.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The Buddha delivered this sermon to remind his disciples of the impermanent nature of the world and of our existence, which is subject to decay and renewal and from which even a god like Brahma is not free unless he overcomes it by practicing Dhamma and following the eight-fold path.&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/buddhas-discourse-on-end-of-world.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-6929864299091512171</guid><pubDate>Wed, 22 Apr 2015 08:18:00 +0000</pubDate><atom:updated>2015-04-22T13:48:27.852+05:30</atom:updated><title>Significance of Havan (Homam)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Hinduism- the oldest living religion in the world- strongly believes in eradicating inner as well as outer imperfections by destroying undesirable elements and enriching positive energies in the environment.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;To attain the goal of energizing and protecting the inner self and environment, Hinduism has given a significant place to havan/ homam, which is said to be created by Lord Brahma for man’s livelihood &amp;amp; the attainment of his desires.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Havan is a sacred purifying ritual performed by Hindu pundits in temples, homes and working places by involving a sacred fire, Agni God because Hinduism is well aware of the fact that the Sun is the main source of energy and a fire is a representation of the Sun’s energy. As per ancient Hindu texts on havans, any offering to Fire (Agni God) is actually an offering to the Sun. Offerings such as ghee, rice, dry fruits, honey, herbs, wood etc are offered to the sacred fire while reciting Sanskrit mantras.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; float: left; font-family: helvetica; font-size: 15px; line-height: 25px; margin: 10px 10px 10px 0px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;h3 style=&quot;background-color: white; color: #993300; font-family: &#39;Open Sans&#39;, &#39;Franklin Gothic Medium&#39;, &#39;Arial Narrow Bold&#39;, Arial, sans-serif; font-size: 18px; line-height: 27px; margin: 0px 0px 0.3em; text-align: justify; text-rendering: optimizelegibility;&quot;&gt;&lt;strong&gt;Scientific Experiments with Agnihotra&lt;/strong&gt;&lt;/h3&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;strong&gt;Agnihotra Effect on Bacterial Population: &amp;nbsp;&lt;/strong&gt;A preliminary experiment was carried out to study the effect of Agnihotra on the bacterial population in a room where Agnihotra was performed. For this study, two rooms of equal dimensions (13¼’ x 8’ x 11’) were selected. In both rooms fire was prepared from dried cowdung cakes in copper pyramids and the basal reading of number of microorganisms in both the rooms was taken by exposing blood agar plates at four corners of the room for 10 minutes. This was done exactly half an hour before Agnihotra time. Agnihotra was performed exactly at sunset in one of the rooms. Bacterial counts were taken again in both the rooms in a similar manner at half hour intervals. Thus readings were taken in both the rooms up to two hours after performance of Agnihotra. It was quite interesting to note that microbial counts in the room where Agnihotra was performed were reduced by 91.4% whereas the room where only fire was generated did not show appreciable changes in the microbial counts. This leads one to think that it was the process of Agnihotra which was responsible for the reduction of bacterial counts and not the mere presence of fire.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;strong&gt;Two other similar experiments revealed similar findings. The phenomenon could be explained by giving two reasons:&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;- Agnihotra fumes are rich in formaldehyde and other substances which have inhibitory effect on microorganisms.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;- A phenomenon like smog formation and its diffusion in the upper strata might be a likely postulation.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;In the regions of North and South poles, many times, carbon particles accumulate to form a layer called “smog”. When fire is lit the hot currents push the smog into the upper strata and it is diffused in such a way that the carbon particles are no longer harmful in the residual concentration. In the present study perhaps&lt;br /&gt;Agnihotra fumes might have dissociated the microorganisms in such a way that the residual population was no more harmful and was well within tolerable limit to human beings.&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/significance-of-havan-homam.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-3471249074199445012</guid><pubDate>Wed, 22 Apr 2015 08:17:00 +0000</pubDate><atom:updated>2015-04-22T13:47:26.415+05:30</atom:updated><title>Plastic Surgery in Ancient India</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Although many people consider Plastic Surgery as a relatively new specialty, the origin of the plastic surgery had his roots more than 4000 years old in India, back to the Indus River Civilization. The mythico-religious shlokas (hymns) associated with this civilization were compiled in Sanskrit language between 3000 and 1000 B.C. in the form of Vedas, the oldest sacred books of the Hindu religion. This era is referred to as the Vedic period (5000 years B.C) in Indian history during which the the four Vedas, namely the Rigveda, the Samaveda, the Yajurveda, and the Atharvaveda were compiled. All the four Vedas are in the form of shlokas (hymns), verses, incantations and rites in Sanskrit language.&lt;span style=&quot;font-size: 10.9090909957886px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;‘Sushruta Samhita’ is believed to be a part of Atharvaveda.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;‘Sushruta Samhita’ (Sushruta’s compendium), which describes the ancient tradition of surgery in Indian medicine is considered as one of the most brilliant gems in Indian medical literature. This treatise contains detailed descriptions of teachings and practice of the great ancient surgeon Sushruta which has considerable surgical knowledge of relevance even today.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;a data-slb-active=&quot;1&quot; data-slb-group=&quot;20985&quot; data-slb-internal=&quot;20987&quot; href=&quot;http://www.sanskritimagazine.com/?attachment_id=20987&quot; style=&quot;color: #fe4e47; outline: 0px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Plastic Surgery in Ancient India&quot; class=&quot;alignright wp-image-20987&quot; height=&quot;316&quot; src=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2014/12/gr1.gif&quot; style=&quot;-webkit-user-select: none; border: 0px; display: inline; float: right; height: auto; margin-bottom: 15px; margin-left: 10px; margin-top: 4px; max-width: 100%; vertical-align: middle;&quot; width=&quot;284&quot; /&gt;&lt;/a&gt;The ‘Sushruta Samhita’ contains the major surgical text of the Vedas and is considered to be the most advanced compilation of surgical practices of its time. ‘Sushruta Samhita’ encomprises not only the teaching regarding the plastic surgery but contains composite teachings of the surgery and all the allied branches including midwifery and making it a comprehensive treatise on the entire medical discipline. Sushruta believed that knowledge of both surgery and medicine are essential to constitute a good doctor who otherwise “is like a bird with only one wing.” In fact, Sushruta emphasized in his text that unless one possesses enough knowledge of relevant sister branches of learning, one cannot attain proficiency in one’s own subject of study. According to Sushruta, “Any one, who wishes to acquire a thorough knowledge of anatomy, must prepare a dead body and carefully observe and examine all its parts”. The method of study was to submerge the body in water and allow it to decompose followed by examination of the decomposing body at intervals to study structures, layer by layer, as they got exposed following decomposition. The most important point to note here is that the dissection was performed without using knife.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The exact period of Sushruta is unclear but most scholars put him him between 600 to 1000 BC.&amp;nbsp;&amp;nbsp;Sushruta lived, taught and practiced his art in the area that corresponds presently to the city of Varanasi (Kashi, Benares) in northern part of India. Varanasi, on the banks of the Ganges is one of the holiest places in India and is also the home of Buddhism and Ayurveda, one of the oldest medical disciplines. The followers of Sushruta were called as Saushrutas. The new student was expected to study for at least 6 years. Before starting his training he had to take a solemn oath, which can be compared to that of Hippocrates.&lt;span style=&quot;font-size: 10.9090909957886px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;He taught the surgical skills to his students on various experimental modules, for instance, incision on vegetables (like watermelon, gourd, cucumber etc.), probing on worm eaten wood, preceding present day workshops by more than 2600 years.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;This master literature remained preserved for many centuries exclusively in the Sanskrit language which prevented the dissemination. of the knowledge to the west and other parts of the world. Later the original text was lost and the present extant one is believed to be a revision by the Buddhist scholar Vasubandhu (circa AD 360-350). In the eighth century A.D., ‘Sushruta Samhita’ was translated into Arabic as Kitab-Shaw Shoon-a-Hindi and Kitab-i-Susrud. The translation of ‘Sushruta Samhita’ was ordered by the Caliph Mansur (A.D.753 -774).&lt;span style=&quot;font-size: 10.9090909957886px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;One of the most important documents in connection with ancient Indian medicine is the Bower Manuscript, a birch-bark medical treatise discovered in Kuchar (in Eastern Turkistan), dated around AD 450 and is housed in the Oxford University library.&amp;nbsp;The first European translation of ‘Sushruta Samhita’ was published by Hessler in Latin and into German by Muller in the early 19th century. The first complete English translation was done by Kaviraj Kunja Lal Bhishagratna in three volumes in 1907 at Calcutta.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The treatise’s insight, accuracy and detail of the surgical descriptions are most impressive. In the book’s 184 chapters, 1,120 conditions are listed, including injuries and illnesses relating to ageing and mental illness. The compendium of Sushruta includes many chapters on the training and practice of surgeons. The Sushruta Samhita describes over 120 surgical instruments, &amp;nbsp;300 surgical procedures and classifies human surgery in 8 categories.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The ancient surgical science was known as Salya-tantra. Salya-tantra (surgical science) embraces all processes aiming at the removal of factors responsible for producing pain or misery to the body or mind. Salya (salya-surgical instrument) denotes broken parts of an arrow /other sharp weapons while tantra denotes maneuver. The broken parts of the arrows or similar pointed weapons were regarded as the commonest and most dangerous objects causing wounds and requiring surgical treatment. Shushruta has described surgery under eight heads Chedya (excision), Lekhya (scarification), Vedhya (puncturing), Esya (exploration), Ahrya (extraction), Vsraya (evacuation) and Sivya (Suturing).&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;a data-slb-active=&quot;1&quot; data-slb-group=&quot;20985&quot; data-slb-internal=&quot;20989&quot; href=&quot;http://www.sanskritimagazine.com/ayurveda/plastic-surgery-ancient-india/attachment/the-first-rhinoplasty/&quot; style=&quot;color: #fe4e47; outline: 0px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Plastic Surgery in Ancient India&quot; class=&quot;alignright wp-image-20989&quot; height=&quot;325&quot; src=&quot;http://www.sanskritimagazine.com/wp-content/uploads/2014/12/The-First-Rhinoplasty.jpeg&quot; style=&quot;-webkit-user-select: none; border: 0px; display: inline; float: right; height: auto; margin-bottom: 15px; margin-left: 10px; margin-top: 4px; max-width: 100%; vertical-align: middle;&quot; width=&quot;182&quot; /&gt;&lt;/a&gt;All the basic principles of plastic surgery like planning, precision, haemostasis and perfection find an important place in Sushruta’s writings on this subject. Sushruta described various reconstructive methods or different types of defects like release of the skin for covering small defects, rotation of the flaps to make up for the partial loss and pedicle flaps for covering complete loss of skin from an area.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;One of the great highlight of Sushruta’s surgery was the operation of Rhinoplasty. The making of a new nose captured the imagination of the medical world and brought him fame as the originator of plastic surgery.&amp;nbsp;The famous Indian Rhinoplasty (reproduced in the October 1794 issue of the Gentleman’s Magazine of London) is a modification of the ancient Rhinoplasty described by Sushruta in 600 B.C. Even today pedicled forehead flap is referred to as the Indian flap.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Ackernecht has aptly observed – ”There is little doubt that plastic surgery in Europe which flourished in medieval Italy is a direct descendant of classical Indian surgery”.&lt;span style=&quot;font-size: 10.9090909957886px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;In describing the method of Rhinoplasty (Nasikasandhana) Sushruta says:&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;&lt;strong&gt;&lt;em&gt;“The portion of the nose to be covered should be first measured with a leaf. Then a piece of skin of the required size should be dissected from the living skin of the cheek, and turned back to cover the nose, keeping a small pedicle attached to the cheek. The part of the nose to which the skin is to be attached should be made raw by cutting the nasal stump with a knife. The physician then should place the skin on the nose and stitch the two parts swiftly, keeping the skin properly elevated by inserting two tubes of eranda (the castor-oil plant) in the position of the nostrils, so that the new nose gets proper shape. The skin thus properly adjusted, it should then be sprinkled with a powder of liquorice, red sandal-wood and barberry plant. Finally, it should be covered with cotton, and clean sesame oil should be constantly applied. When the skin has united and granulated, if the nose is too short or too long, the middle of the flap should be divided and an endeavor made to enlarge or shorten it.” (SS. 1.16).&lt;/em&gt;&lt;/strong&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; float: none; font-family: helvetica; font-size: 15px; line-height: 25px; margin: 0px; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Speculations have been raised as how, in the absence of anesthetics, the Indian surgeons carried out such major operations. Sushruta writes that “wine should be used before operation to produce insensibility to pain.” He again remarks: “The patient who has been fed, does not faint, and he who is rendered intoxicated, does not feel the pain of the operation.”&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Sushruta considered surgery the first and foremost branch of medicine and stated: “Surgery has the superior advantage of producing instantaneous effects by means of surgical instruments and appliances. Hence, it is the highest in value of all the medical tantras. It is eternal and a source of infinite piety, imports fame and opens the gates of Heaven to its votaries. It prolongs the duration of human existence on earth and helps men in successfully fulfilling their missions and earning a decent competence in life.”&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;Health, according to Sushruta is a state of physical and mental well-being brought about and preserved by the maintenance of humours, good nutrition, proper elimination of waste products and a pleasant harmony of the body and the mind. Sushruta says there can be nothing more magnificent than the act of treating human suffering, life giving, indeed is virtue and fame personified.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;He warns that improper intervention with surgical maneuver due either to ignorance of the progress of the disease-process, greed for money or lack of judgment, lead only to complications. Sushruta’s general advice to physicians would certainly apply to doctors in any age and anywhere in the world: ‘‘A physician who has set out on this path should have witnessed operations. He must be licensed by the king. He should be clean and keep his nails and hair short. He should be cheerful, well-spoken and honest’‘.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The genius of Sushruta prompted eminent surgeon Whipple to declare – “All in all, Susruta must be considered the greatest surgeon of the premedieval period.”&amp;nbsp;Rhazes repeatedly quoted Sushruta as the foremost authority in surgery.&lt;/div&gt;&lt;div style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; margin-bottom: 15px; text-align: justify;&quot;&gt;The Sushruta’s contribution in the field of Plastic Surgery can be enumerated as follows:&lt;/div&gt;&lt;ol style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px; text-align: justify;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Rhinoplasty (cheek)&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Classification of mutilated ear lobe defects and techniques for repair of torn ear lobes (15 different types of otoplasties)&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Cheek flap for reconstruction of absent ear lobe.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Repair of accidental lip injuries and congenital cleft lip.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Piercing children’s ear lobe with a needle or awl.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Use of suture materials of bark, tendon, hair and silk.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Needles of bronze or bone (circular, two finger-breadths wide and straight, triangular bodied, three finger – breadths wide)&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Classification of burns into four degrees and explaining the effect of heat stroke, frostbite, and lightening injuries.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Fourteen types of bandaging capable of covering almost all the regions of the body and different methods of dressings with various medicaments.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Use of wine to dull the pain of surgical incisions.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Described 20 varieties of sharp instruments *(sastra) and 101 types of blunt instruments (yantra) and their handling techniques.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Systematic dissection of cadavers.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Advocated the practice of mock operations on inanimate objects such as watermelons, clay plots and reeds.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Use of leeches to keep wounds free of blood clots.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;A code of ethics for teachers as well as students.&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;content&quot; style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; text-align: justify;&quot;&gt;&lt;div class=&quot;article_section&quot;&gt;&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;*”should have an edge so fine that it should divide the hairs on the skin.”&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;The Sushruta’s contributions to allied fields are:&lt;/div&gt;&lt;ol style=&quot;list-style: none; margin: 0px 0px 15px 10px; padding: 0px 0px 0px 20px;&quot;&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Surgical demonstration of techniques of making incisions, probing, extraction of foreign bodies, alkali and thermal cauterization, tooth extraction, excisions, trocars for draining abscess draining hydrocele and ascitic fluid.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Described removal of the prostate gland, urethral stricture dilatation, vesiculolithotomy, hernia surgery, caesarian section, management of haemorrhoids, fistulae, laparotomy and management of intestinal obstruction, perforated intestines, accidental perforation of the abdomen with protrusion of omentum.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Classified details of the six types of dislocations, twelve varieties of fractures and classification of the bones and their reaction to the injuries.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Principles of fracture management, viz., traction, manipulation, appositions and stabilization including some measures of rehabilitation and fitting of prosthetics.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Classification of eye diseases (76) with signs, symptoms, prognosis, medical/surgical interventions and cataract surgery.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Description of method of stitching the intestines by using ant-heads as stitching material.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;First to deal with embryology and sequential development of the structures of the fetus.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Dissection and study of anatomy of human body.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Introduction of wine to dull the pain of surgical incisions.&lt;/li&gt;&lt;li style=&quot;line-height: 20px; list-style: decimal; margin: 0px; padding: 0px;&quot;&gt;Enumeration of 1120 illnesses and recommended diagnosis by inspection, palpation and auscultation.&lt;/li&gt;&lt;/ol&gt;&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;Sushruta took surgery in medieval India to admirable heights and that era was later regarded as The Golden Age of Surgery in ancient India .Because of his numerous seminal contributions to the science and art of surgery in India, he is regarded as the ‘Father of Indian Surgery’ and the ‘Father of Indian Plastic Surgery’.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;In “The source book of plastic surgery’‘, Frank McDowell aptly described Sushruta as follows:&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;&lt;em&gt;&lt;strong&gt;“Through all of Sushruta’s flowery language, incantations and irrelevancies, there shines the unmistakable picture of a great surgeon. Undaunted by his failures, unimpressed by his successes, he sought the truth unceasingly and passed it on to those who followed. He attacked disease and deformity definitively, with reasoned and logical methods. When the path did not exist, he made one.”&lt;/strong&gt;&lt;/em&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;about_author&quot; style=&quot;background-color: white; font-family: helvetica; font-size: 15px; line-height: 25px; text-align: justify;&quot;&gt;&lt;h4 style=&quot;color: inherit; font-family: &#39;Open Sans&#39;, &#39;Franklin Gothic Medium&#39;, &#39;Arial Narrow Bold&#39;, Arial, sans-serif; font-size: 17.5px; font-weight: normal; line-height: 1; margin: 0px 0px 0.3em; text-rendering: optimizelegibility;&quot;&gt;References&lt;/h4&gt;&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;1. Sushruta Samhita. English translation by Kaviraj Kunja Lal Bhishagratna, Calcutta, 1907, Chapter 16, 152-154.&lt;br /&gt;2. Bhishagratna KK. The Sushruta Samhita. [English translation based on &amp;nbsp;the original Sanskrit text.] Varanasi, India, 1963; Chowkhamba Sanskrit &amp;nbsp;Series Office.&lt;br /&gt;3. Raju VK. Sushruta of ancient India. Indian J Ophthalmol 2003; 51:119-&amp;nbsp;122.&lt;br /&gt;4. Rana RE, Arora BS. History of plastic surgery in India. Journal of &amp;nbsp;postgraduate Medicine 2002; 48:76-8.&lt;br /&gt;5. Das S. Urology in ancient India. Indian J Urol 2007;23:2-5.&lt;br /&gt;6. Wise TA. Commentary on the Hindu system of medicine. Thacker: &amp;nbsp;Calcutta; 1845:1.&lt;br /&gt;7. Hoernle AF. Studies in the medicine of ancient India. Clarendon Press: &amp;nbsp;Oxford; 1907:109.&lt;br /&gt;8. Johnston-Saint P. An outline of the history of medicine in India. Indian Med Rec 1929; 49:289.&lt;br /&gt;9. Iram R. The Far East. In : Iram R, editor. Surgery. An illustrated history. &amp;nbsp;Philadelphia: Mosby; 1993: 65-9.&lt;br /&gt;10. Tewari M, Shukla HS Sushruta: ‘The Father of Indian Surgery’ Indian &amp;nbsp;Journal of Surgery.2005; 67(4):229-230.&lt;br /&gt;11. Chari PS. Sushruta and our heritage. Indian Journal of plastic surgery &amp;nbsp;2003; 36:4-13.&lt;br /&gt;12. Hoernle AFR. The Bower Manuscript. Reprinted in Studies in the &amp;nbsp;History of Science in India. 1982. Vol. I. (Ed.) Debiprasad &amp;nbsp;Chattopadhyaya. New Delhi: Editorial Enterprises.116-140.&lt;br /&gt;13. Mukhopadhyaya G. The surgical instruments of the Hindus, with a &amp;nbsp;comparative Study of the surgical instruments of Greek, Roman, Arab &amp;nbsp;and The modern European surgeons. Calcutta University Press: Calcutta; 1913:17.&lt;br /&gt;14. Agarwal DP. Susruta: The Great Surgeon of Yore. &amp;nbsp;http://www.infinityfoundation.com/mandala/t_es/t_es_agraw_susruta_frameset.htm.Accessed on 07/07/2007&lt;br /&gt;15. Castiglioni A. A History of Medicine, 2nd ed. Knopf AA. New York; 1947:85.&lt;br /&gt;16. Ackernecht EH. A short history of medicine. Johns Hopkins University Press: 1982:41.&lt;br /&gt;17. Muley G Susruta: Great Scientists of ancient India. http://www.vigyanprasar.gov.in/dream/july2000.article.htm.Accessed on 07/07/2007&lt;br /&gt;18. Whipple AO. The story of wound healing and wound repair. Thomas C. Springfield: 1963:18.&lt;br /&gt;19. Frank McDowell. The Source Book of Plastic Surgery. Baltimore; Williams and Wilkins Company: 1977:5-85.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 15px;&quot;&gt;&lt;span style=&quot;color: #666699;&quot;&gt;&lt;em&gt;~&amp;nbsp;&lt;strong&gt;Sanjay Saraf, MS, MCh. (Plastic Surgery), Dep. National Board (Plastic Surgery), MNAMS&amp;nbsp;&lt;/strong&gt;Dept. of Plastic Surgery, NMC Specialty Hospital&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #666699;&quot;&gt;&lt;em&gt;&lt;strong&gt;~ Ravi S. Parihar, MCh. (Orth)&amp;nbsp;&lt;/strong&gt;Consultant Orthopaedic and Trauma Surgeon, Suncity Hospital&lt;/em&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/plastic-surgery-in-ancient-india.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-894375661505797563</guid><pubDate>Tue, 21 Apr 2015 17:33:00 +0000</pubDate><atom:updated>2015-04-21T23:03:26.579+05:30</atom:updated><title>C++ Classes and Objects</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The main purpose of C++ programming is to add object orientation to the C programming language and classes are the central feature of C++ that supports object-oriented programming and are often called user-defined types.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A class is used to specify the form of an object and it combines data representation and methods for manipulating that data into one neat package. The data and functions within a class are called members of the class.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;C++ Class Definitions:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When you define a class, you define a blueprint for a data type. This doesn&#39;t actually define any data, but it does define what the class name means, that is, what an object of the class will consist of and what operations can be performed on such an object.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A class definition starts with the keyword&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;class&lt;/b&gt;&amp;nbsp;followed by the class name; and the class body, enclosed by a pair of curly braces. A class definition must be followed either by a semicolon or a list of declarations. For example, we defined the Box data type using the keyword&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;class&lt;/b&gt;&amp;nbsp;as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; length&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Length of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; breadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Breadth of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Height of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The keyword&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;public&lt;/b&gt;&amp;nbsp;determines the access attributes of the members of the class that follow it. A public member can be accessed from outside the class anywhere within the scope of the class object. You can also specify the members of a class as&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;private&lt;/b&gt;&amp;nbsp;or&lt;b style=&quot;box-sizing: border-box;&quot;&gt;protected&lt;/b&gt;&amp;nbsp;which we will discuss in a sub-section.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Define C++ Objects:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A class provides the blueprints for objects, so basically an object is created from a class. We declare objects of a class with exactly the same sort of declaration that we declare variables of basic types. Following statements declare two objects of class Box:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Declare Box1 of type Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Declare Box2 of type Box&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Both of the objects Box1 and Box2 will have their own copy of data members.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Accessing the Data Members:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The public data members of objects of a class can be accessed using the direct member access operator (.). Let us try the following example to make the things clear:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; length&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Length of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; breadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Breadth of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Height of a box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Declare Box1 of type Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Declare Box2 of type Box&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Store the volume of a box here&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// box 1 specification&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;6.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;breadth &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;7.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// box 2 specification&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;12.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;breadth &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;13.0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// volume of box 1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;breadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Volume of Box1 : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// volume of box 2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;height &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;length &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;breadth&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Volume of Box2 : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; volume &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Volume&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;210&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Volume&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Box2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1560&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;It is important to note that private and protected members can not be accessed directly using direct member access operator (.). We will learn how private and protected members can be accessed.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Classes &amp;amp; Objects in Detail:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;So far, you have got very basic idea about C++ Classes and Objects. There are further interesting concepts related to C++ Classes and Objects which we will discuss in various sub-sections listed below:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;40%&quot;&gt;Concept&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_class_member_functions.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Class Member Functions&quot;&gt;Class member functions&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A member function of a class is a function that has its definition or its prototype within the class definition like any other variable.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_class_access_modifiers.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Class Access Modifiers&quot;&gt;Class access modifiers&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A class member can be defined as public, private or protected. By default members would be assumed as private.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Constructor &amp;amp; Destructor&quot;&gt;Constructor &amp;amp; destructor&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A class constructor is a special function in a class that is called when a new object of the class is created. A destructor is also a special function which is called when created object is deleted.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_copy_constructor.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Copy Constructor&quot;&gt;C++ copy constructor&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_friend_functions.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Friend Functions&quot;&gt;C++ friend functions&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;friend&lt;/b&gt;&amp;nbsp;function is permitted full access to private and protected members of a class.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_inline_functions.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Inline Functions&quot;&gt;C++ inline functions&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;With an inline function, the compiler tries to expand the code in the body of the function in place of a call to the function.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_this_pointer.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;The this Pointer in C++&quot;&gt;The this pointer in C++&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Every object has a special pointer&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;this&lt;/b&gt;&amp;nbsp;which points to the object itself.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_pointer_to_class.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Pointer to C++ Classes&quot;&gt;Pointer to C++ classes&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A pointer to a class is done exactly the same way a pointer to a structure is. In fact a class is really just a structure with functions in it.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_static_members.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Static members of a class&quot;&gt;Static members of a class&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Both data members and function members of a class can be declared as static.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-classes-and-objects.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-6159786687299961723</guid><pubDate>Tue, 21 Apr 2015 17:18:00 +0000</pubDate><atom:updated>2015-04-21T22:48:04.093+05:30</atom:updated><title>C++ Data Structures</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ standard libraries provide an extensive set of input/output capabilities which we will see in subsequent chapters. This chapter will discuss very basic and most common I/O operations required for C++ programming.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ I/O occurs in streams, which are sequences of bytes. If bytes flow from a device like a keyboard, a disk drive, or a network connection etc. to main memory, this is called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;input operation&lt;/b&gt;&amp;nbsp;and if bytes flow from main memory to a device like a display screen, a printer, a disk drive, or a network connection, etc, this is called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;output operation&lt;/b&gt;.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;I/O Library Header Files:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are following header files important to C++ programs:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;20%&quot;&gt;Header File&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Function and Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This file defines the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cin, cout, cerr&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;objects, which correspond to the standard input stream, the standard output stream, the un-buffered standard error stream and the buffered standard error stream, respectively.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;iomanip&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This file declares services useful for performing formatted I/O with so-called parameterized stream manipulators, such as&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;setw&lt;/b&gt;&amp;nbsp;and&lt;b style=&quot;box-sizing: border-box;&quot;&gt;setprecision&lt;/b&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This file declares services for user-controlled file processing. We will discuss about it in detail in File and Stream related chapter.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard output stream (cout):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cout&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;ostream&lt;/b&gt;&amp;nbsp;class. The cout object is said to be &quot;connected to&quot; the standard output device, which usually is the display screen. The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cout&lt;/b&gt;&amp;nbsp;is used in conjunction with the stream insertion operator, which is written as &amp;lt;&amp;lt; which are two less than signs as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Hello C++&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of str is : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of str &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; C&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;++&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ compiler also determines the data type of variable to be output and selects the appropriate stream insertion operator to display the value. The &amp;lt;&amp;lt; operator is overloaded to output data items of built-in types integer, float, double, strings and pointer values.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The insertion operator &amp;lt;&amp;lt; may be used more than once in a single statement as shown above and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/b&gt;&amp;nbsp;is used to add a new-line at the end of the line.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard input stream (cin):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cin&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;istream&lt;/b&gt;&amp;nbsp;class. The cin object is said to be attached to the standard input device, which usually is the keyboard. The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cin&lt;/b&gt;&amp;nbsp;is used in conjunction with the stream extraction operator, which is written as &amp;gt;&amp;gt; which are two greater than signs as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Please enter your name: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Your name is: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it will prompt you to enter a name. You enter a value and then hit enter to see the result something as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Please&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; enter your name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; cplusplus&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Your&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; cplusplus&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ compiler also determines the data type of the entered value and selects the appropriate stream extraction operator to extract the value and store it in the given variables.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The stream extraction operator &amp;gt;&amp;gt; may be used more than once in a single statement. To request more than one datum you can use the following:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This will be equivalent to the following two statements:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard error stream (cerr):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cerr&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;ostream&lt;/b&gt;&amp;nbsp;class. The cerr object is said to be attached to the standard error device, which is also a display screen but the object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cerr&lt;/b&gt;&amp;nbsp;is un-buffered and each stream insertion to cerr causes its output to appear immediately.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cerr&lt;/b&gt;&amp;nbsp;is also used in conjunction with the stream insertion operator as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Unable to read....&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   cerr &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Error message : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Unable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; to read&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;....&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard log stream (clog):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;ostream&lt;/b&gt;&amp;nbsp;class. The clog object is said to be attached to the standard error device, which is also a display screen but the object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;is buffered. This means that each insertion to clog could cause its output to be held in a buffer until the buffer is filled or until the buffer is flushed.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;is also used in conjunction with the stream insertion operator as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Unable to read....&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   clog &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Error message : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Unable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; to read&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;....&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You would not be able to see any difference in cout, cerr and clog with these small examples, but while writing and executing big programs then difference becomes obvious. So this is good practice to display error messages using cerr stream and while displaying other log messages then clog should be used.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-data-structures.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-723355810496091918</guid><pubDate>Tue, 21 Apr 2015 17:14:00 +0000</pubDate><atom:updated>2015-04-21T22:44:29.063+05:30</atom:updated><title>C++ Basic Input/Output</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ standard libraries provide an extensive set of input/output capabilities which we will see in subsequent chapters. This chapter will discuss very basic and most common I/O operations required for C++ programming.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ I/O occurs in streams, which are sequences of bytes. If bytes flow from a device like a keyboard, a disk drive, or a network connection etc. to main memory, this is called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;input operation&lt;/b&gt;&amp;nbsp;and if bytes flow from main memory to a device like a display screen, a printer, a disk drive, or a network connection, etc, this is called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;output operation&lt;/b&gt;.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;I/O Library Header Files:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are following header files important to C++ programs:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;20%&quot;&gt;Header File&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Function and Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This file defines the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cin, cout, cerr&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;objects, which correspond to the standard input stream, the standard output stream, the un-buffered standard error stream and the buffered standard error stream, respectively.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;iomanip&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This file declares services useful for performing formatted I/O with so-called parameterized stream manipulators, such as&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;setw&lt;/b&gt;&amp;nbsp;and&lt;b style=&quot;box-sizing: border-box;&quot;&gt;setprecision&lt;/b&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;fstream&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This file declares services for user-controlled file processing. We will discuss about it in detail in File and Stream related chapter.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard output stream (cout):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cout&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;ostream&lt;/b&gt;&amp;nbsp;class. The cout object is said to be &quot;connected to&quot; the standard output device, which usually is the display screen. The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cout&lt;/b&gt;&amp;nbsp;is used in conjunction with the stream insertion operator, which is written as &amp;lt;&amp;lt; which are two less than signs as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Hello C++&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of str is : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of str &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; C&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;++&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ compiler also determines the data type of variable to be output and selects the appropriate stream insertion operator to display the value. The &amp;lt;&amp;lt; operator is overloaded to output data items of built-in types integer, float, double, strings and pointer values.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The insertion operator &amp;lt;&amp;lt; may be used more than once in a single statement as shown above and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/b&gt;&amp;nbsp;is used to add a new-line at the end of the line.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard input stream (cin):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cin&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;istream&lt;/b&gt;&amp;nbsp;class. The cin object is said to be attached to the standard input device, which usually is the keyboard. The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cin&lt;/b&gt;&amp;nbsp;is used in conjunction with the stream extraction operator, which is written as &amp;gt;&amp;gt; which are two greater than signs as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Please enter your name: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Your name is: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it will prompt you to enter a name. You enter a value and then hit enter to see the result something as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Please&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; enter your name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; cplusplus&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Your&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; cplusplus&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ compiler also determines the data type of the entered value and selects the appropriate stream extraction operator to extract the value and store it in the given variables.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The stream extraction operator &amp;gt;&amp;gt; may be used more than once in a single statement. To request more than one datum you can use the following:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This will be equivalent to the following two statements:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;cin &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; age&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard error stream (cerr):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cerr&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;ostream&lt;/b&gt;&amp;nbsp;class. The cerr object is said to be attached to the standard error device, which is also a display screen but the object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cerr&lt;/b&gt;&amp;nbsp;is un-buffered and each stream insertion to cerr causes its output to appear immediately.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;cerr&lt;/b&gt;&amp;nbsp;is also used in conjunction with the stream insertion operator as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Unable to read....&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   cerr &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Error message : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Unable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; to read&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;....&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The standard log stream (clog):&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The predefined object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;is an instance of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;ostream&lt;/b&gt;&amp;nbsp;class. The clog object is said to be attached to the standard error device, which is also a display screen but the object&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;is buffered. This means that each insertion to clog could cause its output to be held in a buffer until the buffer is filled or until the buffer is flushed.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clog&lt;/b&gt;&amp;nbsp;is also used in conjunction with the stream insertion operator as shown in the following example.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Unable to read....&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   clog &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Error message : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; message &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Unable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; to read&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;....&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You would not be able to see any difference in cout, cerr and clog with these small examples, but while writing and executing big programs then difference becomes obvious. So this is good practice to display error messages using cerr stream and while displaying other log messages then clog should be used.&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-basic-inputoutput.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-8686126429011115839</guid><pubDate>Tue, 21 Apr 2015 17:12:00 +0000</pubDate><atom:updated>2015-04-21T22:42:18.178+05:30</atom:updated><title>C++ Date and Time</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ standard library does not provide a proper date type. C++ inherits the structs and functions for date and time manipulation from C. To access date and time related functions and structures, you would need to include &amp;lt;ctime&amp;gt; header file in your C++ program.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are four time-related types:&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clock_t, time_t, size_t&lt;/b&gt;, and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;tm&lt;/b&gt;. The types clock_t, size_t and time_t are capable of representing the system time and date as some sort of integer.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The structure type&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;tm&lt;/b&gt;&amp;nbsp;holds the date and time in the form of a C structure having the following elements:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;struct&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_sec&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// seconds of minutes from 0 to 61&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_min&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// minutes of hour from 0 to 59&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_hour&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// hours of day from 0 to 24&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_mday&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// day of month from 1 to 31&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_mon&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// month of year from 0 to 11&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_year&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// year since 1900&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_wday&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// days since sunday&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_yday&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// days since January 1st&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; tm_isdst&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// hours of daylight savings time&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following are the important functions, which we use while working with date and time in C or C++. All these functions are part of standard C and C++ library and you can check their detail using reference to C++ standard library given below.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;5%&quot;&gt;SN&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Function &amp;amp; Purpose&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;time_t time(time_t *time);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This returns the current calendar time of the system in number of seconds elapsed since January 1, 1970. If the system has no time, .1 is returned.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;char *ctime(const time_t *time);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This returns a pointer to a string of the form&amp;nbsp;&lt;i style=&quot;box-sizing: border-box;&quot;&gt;day month year hours:minutes:seconds year\n\0&lt;/i&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;struct tm *localtime(const time_t *time);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This returns a pointer to the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;tm&lt;/b&gt;&amp;nbsp;structure representing local time.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;4&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;clock_t clock(void);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This returns a value that approximates the amount of time the calling program has been running. A value of .1 is returned if the time is not available.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;5&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;char * asctime ( const struct tm * time );&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This returns a pointer to a string that contains the information stored in the structure pointed to by time converted into the form: day month date hours:minutes:seconds year\n\0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;6&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;struct tm *gmtime(const time_t *time);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This returns a pointer to the time in the form of a tm structure. The time is represented in Coordinated Universal Time (UTC), which is essentially Greenwich Mean Time (GMT).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;7&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;time_t mktime(struct tm *time);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This returns the calendar-time equivalent of the time found in the structure pointed to by time.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;8&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double difftime ( time_t time2, time_t time1 );&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function calculates the difference in seconds between time1 and time2.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;9&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;size_t strftime();&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function can be used to format date and time a specific format.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Current date and time:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Consider you want to retrieve the current system date and time, either as a local time or as a Coordinated Universal Time (UTC). Following is the example to achieve the same:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;ctime&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// current date/time based on current system&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;time_t&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; now &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; time&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// convert now to string form&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; dt &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ctime&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;The local date and time is: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; dt &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// convert now to tm struct for UTC&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   tm &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;gmtm &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; gmtime&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   dt &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; asctime&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;gmtm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;The UTC date and time is:&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; dt &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;The&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; date &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; time &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Sat&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Jan&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;07&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;41&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2011&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;The&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; UTC date &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; time &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Sun&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Jan&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;03&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;07&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;41&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2011&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Format time using struct tm:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;tm&lt;/b&gt;&amp;nbsp;structure is very important while working with date and time in either C or C++. This structure holds the date and time in the form of a C structure as mentioned above. Most of the time related functions makes use of tm structure. Following is an example which makes use of various date and time related functions and tm structure:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;While using structure in this chapter, I&#39;m making an assumption that you have basic understanding on C structure and how to access structure members using arrow -&amp;gt; operator.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;ctime&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// current date/time based on current system&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;time_t&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; now &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; time&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Number of sec since January 1,1970:&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; now &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   tm &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;ltm &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; localtime&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// print various components of tm structure.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Year: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1900&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ltm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;tm_year &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Month: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ltm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;tm_mon&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Day: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  ltm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;tm_mday &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Time: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ltm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;tm_hour &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ltm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;tm_min &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ltm&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;tm_sec &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of sec since &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;January&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1970&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1294548238&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Year&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2011&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Month&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Day&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Time&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;44&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;59&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-date-and-time.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-1571475214242417271</guid><pubDate>Tue, 21 Apr 2015 17:08:00 +0000</pubDate><atom:updated>2015-04-21T22:38:14.633+05:30</atom:updated><title>C++ References</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A reference variable is an alias, that is, another name for an already existing variable. Once a reference is initialized with a variable, either the variable name or the reference name may be used to refer to the variable.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;C++ References vs Pointers:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;References are often confused with pointers but three major differences between references and pointers are:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You cannot have NULL references. You must always be able to assume that a reference is connected to a legitimate piece of storage.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Once a reference is initialized to an object, it cannot be changed to refer to another object. Pointers can be pointed to another object at any time.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A reference must be initialized when it is created. Pointers can be initialized at any time.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Creating References in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Think of a variable name as a label attached to the variable&#39;s location in memory. You can then think of a reference as a second label attached to that memory location. Therefore, you can access the contents of the variable through either the original variable name or the reference. For example, suppose we have the following example:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;We can declare reference variables for i as follows.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    r &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Read the &amp;amp; in these declarations as&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;reference&lt;/b&gt;. Thus, read the first declaration as &quot;r is an integer reference initialized to i&quot; and read the second declaration as &quot;s is a double reference initialized to d.&quot;. Following example makes use of references on int and double:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// declare simple variables&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// declare reference variables&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    r &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; s &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;br /&gt;   i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of i : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of i reference : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; r  &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   d &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;11.7&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of d : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of d reference : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; s  &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled together and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of i reference &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of d &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;11.7&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of d reference &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;11.7&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;References are usually used for function argument lists and function return values. So following are two important subjects related to C++ references which should be clear to a C++ programmer:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;40%&quot;&gt;Concept&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/passing_parameters_by_references.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Passing parameters by references in C++&quot;&gt;References as parameters&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C++ supports passing references as function parameter more safely than parameters.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/returning_values_by_reference.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Returning values by reference in C++&quot;&gt;Reference as return value&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;You can return reference from a C++ function like a any other data type can be returned.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-references.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-4315233524231535472</guid><pubDate>Tue, 21 Apr 2015 17:06:00 +0000</pubDate><atom:updated>2015-04-21T22:36:37.482+05:30</atom:updated><title>C++ Pointers</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ pointers are easy and fun to learn. Some C++ tasks are performed more easily with pointers, and other C++ tasks, such as dynamic memory allocation, cannot be performed without them.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;As you know every variable is a memory location and every memory location has its address defined which can be accessed using ampersand (&amp;amp;) operator which denotes an address in memory. Consider the following which will print the address of the variables defined:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  var1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; var2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Address of var1 variable: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;var1 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Address of var2 variable: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;var2 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces result something as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of var1 variable&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0xbfebd5c0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of var2 variable&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0xbfebd5b6&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;What Are Pointers?&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;pointer&lt;/b&gt;&amp;nbsp;is a variable whose value is the address of another variable. Like any variable or constant, you must declare a pointer before you can work with it. The general form of a pointer variable declaration is:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;type &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Here,&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;type&lt;/b&gt;&amp;nbsp;is the pointer&#39;s base type; it must be a valid C++ type and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;var-name&lt;/b&gt;&amp;nbsp;is the name of the pointer variable. The asterisk you used to declare a pointer is the same asterisk that you use for multiplication. However, in this statement the asterisk is being used to designate a variable as a pointer. Following are the valid pointer declaration:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// pointer to an integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;dp&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// pointer to a double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;fp&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// pointer to a float&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;ch     &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// pointer to character&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The actual data type of the value of all pointers, whether integer, float, character, or otherwise, is the same, a long hexadecimal number that represents a memory address. The only difference between pointers of different data types is the data type of the variable or constant that the pointer points to.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Using Pointers in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are few important operations, which we will do with the pointers very frequently.&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;(a)&lt;/b&gt;we define a pointer variables&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;(b)&lt;/b&gt;&amp;nbsp;assign the address of a variable to a pointer and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;(c)&lt;/b&gt;&amp;nbsp;finally access the value at the address available in the pointer variable. This is done by using unary operator&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;*&lt;/b&gt;&amp;nbsp;that returns the value of the variable located at the address specified by its operand. Following example makes use of these operations:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// actual variable declaration.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;ip&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// pointer variable &lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   ip &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// store address of var in pointer variable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of var variable: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// print the address stored in ip pointer variable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Address stored in ip variable: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ip &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// access the value at the address available in pointer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Value of *ip variable: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;ip &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces result something as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; variable&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; stored &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;in&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ip variable&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0xbfc601ac&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Value&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; of &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;ip variable&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;20&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;C++ Pointers in Detail:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Pointers have many but easy concepts and they are very important to C++ programming. There are following few important pointer concepts which should be clear to a C++ programmer:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;40%&quot;&gt;Concept&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_null_pointers.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Null Pointers&quot;&gt;C++ Null Pointers&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C++ supports null pointer, which is a constant with a value of zero defined in several standard libraries.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_pointer_arithmatic.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Pointer Arithmetic&quot;&gt;C++ pointer arithmetic&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;There are four arithmetic operators that can be used on pointers: ++, --, +, -&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_pointers_vs_arrays.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Pointers vs Arrays&quot;&gt;C++ pointers vs arrays&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;There is a close relationship between pointers and arrays. Let us check how?&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_array_of_pointers.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Array of Pointers&quot;&gt;C++ array of pointers&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;You can define arrays to hold a number of pointers.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_pointer_to_pointer.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ Pointer to Pointer Operators&quot;&gt;C++ pointer to pointer&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C++ allows you to have pointer on a pointer and so on.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_passing_pointers_to_functions.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Passing pointers to functions in C++&quot;&gt;Passing pointers to functions&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Passing an argument by reference or by address both enable the passed argument to be changed in the calling function by the called function.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_return_pointer_from_functions.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Return pointer from functions in C++&quot;&gt;Return pointer from functions&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C++ allows a function to return a pointer to local variable, static variable and dynamically allocated memory as well.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-pointers.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-5876056721462947789</guid><pubDate>Tue, 21 Apr 2015 17:04:00 +0000</pubDate><atom:updated>2015-04-21T22:34:18.891+05:30</atom:updated><title>C++ Strings</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ provides following two types of string representations:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C-style character string.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The string class type introduced with Standard C++.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The C-Style Character String:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C-style character string originated within the C language and continues to be supported within C++. This string is actually a one-dimensional array of characters which is terminated by a&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;null&lt;/b&gt;&amp;nbsp;character &#39;\0&#39;. Thus a null-terminated string contains the characters that comprise the string followed by a&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;null&lt;/b&gt;.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The following declaration and initialization create a string consisting of the word &quot;Hello&quot;. To hold the null character at the end of the array, the size of the character array containing the string is one more than the number of characters in the word &quot;Hello.&quot;&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; greeting&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;H&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;e&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;l&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;l&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;o&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;\0&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;If you follow the rule of array initialization, then you can write the above statement as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; greeting&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the memory presentation of above defined string in C/C++:&lt;/div&gt;&lt;center style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;img alt=&quot;String Presentation in C/C++&quot; src=&quot;http://www.tutorialspoint.com/cplusplus/images/string_representation.jpg&quot; style=&quot;box-sizing: border-box; display: block; margin-left: auto; margin-right: auto; max-width: 100%; padding-bottom: 4px; vertical-align: middle;&quot; /&gt;&lt;/center&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Actually, you do not place the null character at the end of a string constant. The C++ compiler automatically places the &#39;\0&#39; at the end of the string when it initializes the array. Let us try to print above-mentioned string:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; greeting&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;H&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;e&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;l&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;l&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;o&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;\0&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Greeting message: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; greeting &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces result something as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Greeting&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Hello&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ supports a wide range of functions that manipulate null-terminated strings:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;5%&quot;&gt;S.N.&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Function &amp;amp; Purpose&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;strcpy(s1, s2);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Copies string s2 into string s1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;strcat(s1, s2);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Concatenates string s2 onto the end of string s1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;strlen(s1);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Returns the length of string s1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;4&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;strcmp(s1, s2);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Returns 0 if s1 and s2 are the same; less than 0 if s1&amp;lt;s2; greater than 0 if s1&amp;gt;s2.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;5&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;strchr(s1, ch);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Returns a pointer to the first occurrence of character ch in string s1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;6&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;strstr(s1, s2);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Returns a pointer to the first occurrence of string s2 in string s1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following example makes use of few of the above-mentioned functions:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;cstring&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;World&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;];&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  len &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// copy str1 into str3&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   strcpy&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;strcpy( str3, str1) : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// concatenates str1 and str2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   strcat&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;strcat( str1, str2): &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// total lenghth of str1 after concatenation&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   len &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; strlen&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;strlen(str1) : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; len &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces result something as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;strcpy&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;strcat&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;):&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;HelloWorld&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;strlen&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The String Class in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The standard C++ library provides a&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;string&lt;/b&gt;&amp;nbsp;class type that supports all the operations mentioned above, additionally much more functionality. We will study this class in C++ Standard Library but for now let us check following example:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;At this point, you may not understand this example because so far we have not discussed Classes and Objects. So can have a look and proceed until you have understanding on Object Oriented Concepts.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Hello&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str2 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;World&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  len &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// copy str1 into str3&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   str3 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;str3 : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// concatenates str1 and str2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   str3 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str1 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;str1 + str2 : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// total lenghth of str3 after concatenation&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   len &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;str3.size() :  &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; len &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces result something as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranlate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;str3 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;str1 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; str2 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;HelloWorld&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;str3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-strings.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-3056999755973230142</guid><pubDate>Tue, 21 Apr 2015 16:33:00 +0000</pubDate><atom:updated>2015-04-21T22:03:12.256+05:30</atom:updated><title>Numbers in C++</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Normally, when we work with Numbers, we use primitive data types such as int, short, long, float and double, etc. The number data types, their possible values and number ranges have been explained while discussing C++ Data Types.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Defining Numbers in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You have already defined numbers in various examples given in previous chapters. Here is another consolidated example to define various types of numbers in C++:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// number definition:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;short&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  s&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;long&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   l&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  f&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// number assignments;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   s &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;      &lt;br /&gt;   i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    &lt;br /&gt;   l &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1000000&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;   f &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;230.47&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;br /&gt;   d &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;30949.374&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// number printing;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;short  s :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; s &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;int    i :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;long   l :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; l &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;float  f :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; f &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;double d :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;short&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  s &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;long&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   l &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1000000&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  f &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;230.47&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;30949.4&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Math Operations in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;In addition to the various functions you can create, C++ also includes some useful functions you can use. These functions are available in standard C and C++ libraries and called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;built-in&lt;/b&gt;&amp;nbsp;functions. These are functions that can be included in your program and then use.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ has a rich set of mathematical operations, which can be performed on various numbers. Following table lists down some useful built-in mathematical functions available in C++.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;To utilize these functions you need to include the math header file&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;&amp;lt;cmath&amp;gt;&lt;/b&gt;.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;5%&quot;&gt;S.N.&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Function &amp;amp; Purpose&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double cos(double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function takes an angle (as a double) and returns the cosine.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double sin(double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function takes an angle (as a double) and returns the sine.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double tan(double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function takes an angle (as a double) and returns the tangent.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;4&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double log(double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function takes a number and returns the natural log of that number.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;5&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double pow(double, double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The first is a number you wish to raise and the second is the power you wish to raise it t&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;6&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double hypot(double, double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;If you pass this function the length of two sides of a right triangle, it will return you the length of the hypotenuse.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;7&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double sqrt(double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You pass this function a number and it gives you this square root.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;8&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;int abs(int);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function returns the absolute value of an integer that is passed to it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;9&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double fabs(double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This function returns the absolute value of any decimal number passed to it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;10&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double floor(double);&lt;/b&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Finds the integer which is less than or equal to the argument passed to it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following a simple example to show few of the mathematical operations:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;cmath&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// number definition:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;short&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  s &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;long&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   l &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;100000&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  f &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;230.47&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;double&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;200.374&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// mathematical operations;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;sin(d) :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; sin&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;abs(i)  :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; abs&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;floor(d) :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; floor&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;sqrt(f) :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; sqrt&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;pow( d, 2) :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; pow&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;sign&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:-&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0.634939&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;abs&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;floor&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;sqrt&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;15.1812&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;pow&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; d&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;40149.7&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Random Numbers in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are many cases where you will wish to generate a random number. There are actually two functions you will need to know about random number generation. The first is&lt;b style=&quot;box-sizing: border-box;&quot;&gt;rand()&lt;/b&gt;, this function will only return a pseudo random number. The way to fix this is to first call the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;srand()&lt;/b&gt;&amp;nbsp;function.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is a simple example to generate few random numbers. This example makes use of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;time()&lt;/b&gt;&amp;nbsp;function to get the number of seconds on your system time, to randomly seed the rand() function:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;ctime&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;cstdlib&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;j&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// set the seed&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   srand&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;unsigned&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; NULL &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;/* generate 10  random numbers. */&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// generate actual random number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      j&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; rand&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot; Random Number : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; j &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1748144778&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;630873888&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2134540646&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;219404170&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;902129458&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;920445370&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1319072661&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;257938873&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1256201101&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Random&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Number&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;580322989&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/numbers-in-c.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-7108659007749188282</guid><pubDate>Tue, 21 Apr 2015 15:50:00 +0000</pubDate><atom:updated>2015-04-21T21:20:28.099+05:30</atom:updated><title>C++ Functions</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A function is a group of statements that together perform a task. Every C++ program has at least one function, which is&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;main()&lt;/b&gt;, and all the most trivial programs can define additional functions.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You can divide up your code into separate functions. How you divide up your code among different functions is up to you, but logically the division usually is so each function performs a specific task.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A function&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;declaration&lt;/b&gt;&amp;nbsp;tells the compiler about a function&#39;s name, return type, and parameters. A function&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;definition&lt;/b&gt;&amp;nbsp;provides the actual body of the function.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The C++ standard library provides numerous built-in functions that your program can call. For example, function&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;strcat()&lt;/b&gt;&amp;nbsp;to concatenate two strings, function&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;memcpy()&lt;/b&gt;&amp;nbsp;to copy one memory location to another location and many more functions.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A function is knows as with various names like a method or a sub-routine or a procedure etc.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Defining a Function:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The general form of a C++ function definition is as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;return_type function_name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; parameter list &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   body of the &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A C++ function definition consists of a function header and a function body. Here are all the parts of a function:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Return Type&lt;/b&gt;: A function may return a value. The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;return_type&lt;/b&gt;&amp;nbsp;is the data type of the value the function returns. Some functions perform the desired operations without returning a value. In this case, the return_type is the keyword&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;void&lt;/b&gt;.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Function Name:&lt;/b&gt;&amp;nbsp;This is the actual name of the function. The function name and the parameter list together constitute the function signature.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Parameters:&lt;/b&gt;&amp;nbsp;A parameter is like a placeholder. When a function is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a function. Parameters are optional; that is, a function may contain no parameters.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;Function Body:&lt;/b&gt;&amp;nbsp;The function body contains a collection of statements that define what the function does.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Example:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the source code for a function called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;max()&lt;/b&gt;. This function takes two parameters num1 and num2 and returns the maximum between the two:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// function returning the max between two numbers&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; max&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// local variable declaration&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;num1 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Function Declarations:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A function&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;declaration&lt;/b&gt;&amp;nbsp;tells the compiler about a function name and how to call the function. The actual body of the function can be defined separately.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A function declaration has the following parts:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;return_type function_name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; parameter list &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;For the above defined function max(), following is the function declaration:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; max&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Parameter names are not importan in function declaration only their type is required, so following is also valid declaration:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; max&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Function declaration is required when you define a function in one source file and you call that function in another file. In such case, you should declare the function at the top of the file calling the function.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Calling a Function:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;While creating a C++ function, you give a definition of what the function has to do. To use a function, you will have to call or invoke that function.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When a program calls a function, program control is transferred to the called function. A called function performs defined task and when its return statement is executed or when its function-ending closing brace is reached, it returns program control back to the main program.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;To call a function, you simply need to pass the required parameters along with function name, and if function returns a value, then you can store returned value. For example:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// function declaration&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; max&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// local variable declaration:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ret&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// calling a function to get max value.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   ret &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; max&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Max value is : &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; ret &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// function returning the max between two numbers&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; max&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// local variable declaration&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;num1 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; num2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;I kept max() function along with main() function and compiled the source code. While running final executable, it would produce the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Max&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; value &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;200&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Function Arguments:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;If a function is to use arguments, it must declare variables that accept the values of the arguments. These variables are called the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;formal parameters&lt;/b&gt;&amp;nbsp;of the function.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The formal parameters behave like other local variables inside the function and are created upon entry into the function and destroyed upon exit.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;While calling a function, there are two ways that arguments can be passed to a function:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;30%&quot;&gt;Call Type&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_function_call_by_value.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ function call by value&quot;&gt;Call by value&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This method copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_function_call_by_pointer.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ function call by pointer&quot;&gt;Call by pointer&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This method copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. This means that changes made to the parameter affect the argument.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_function_call_by_reference.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ function call by reference&quot;&gt;Call by reference&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;This method copies the reference of an argument into the formal parameter. Inside the function, the reference is used to access the actual argument used in the call. This means that changes made to the parameter affect the argument.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;By default, C++ uses&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;call by value&lt;/b&gt;&amp;nbsp;to pass arguments. In general, this means that code within a function cannot alter the arguments used to call the function and above mentioned example while calling max() function used the same method.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Default Values for Parameters:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When you define a function, you can specify a default value for each of the last parameters. This value will be used if the corresponding argument is left blank when calling to the function.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This is done by using the assignment operator and assigning values for the arguments in the function definition. If a value for that parameter is not passed when the function is called, the default given value is used, but if a value is specified, this default value is ignored and the passed value is used instead. Consider the following example:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; sum&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;  result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;  &lt;br /&gt;  &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// local variable declaration:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; a &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// calling a function to add the values.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; sum&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Total value is :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// calling a function again as follows.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; sum&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Total value is :&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; result &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Total&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; value &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Total&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; value &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;120&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-functions.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-5993587443702167976</guid><pubDate>Tue, 21 Apr 2015 15:45:00 +0000</pubDate><atom:updated>2015-04-21T21:15:35.265+05:30</atom:updated><title>C++ decision making statements</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the general from of a typical decision making structure found in most of the programming languages:&lt;/div&gt;&lt;center style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;img alt=&quot;C++ decision making&quot; src=&quot;http://www.tutorialspoint.com/cplusplus/images/cpp_decision_making.jpg&quot; style=&quot;box-sizing: border-box; display: block; margin-left: auto; margin-right: auto; max-width: 100%; padding-bottom: 4px; vertical-align: middle;&quot; /&gt;&lt;/center&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ programming language provides following types of decision making statements. Click the following links to check their detail.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;35%&quot;&gt;Statement&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_if_statement.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ if statement&quot;&gt;if statement&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;An if statement consists of a boolean expression followed by one or more statements.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_if_else_statement.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ if...else statement&quot;&gt;if...else statement&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;An if statement can be followed by an optional else statement, which executes when the boolean expression is false.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_switch_statement.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ switch statement&quot;&gt;switch statement&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A switch statement allows a variable to be tested for equality against a list of values.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_nested_if.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ nested if statements&quot;&gt;nested if statements&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;You can use one if or else if statement inside another if or else if statement(s).&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_nested_switch.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ nested switch statements&quot;&gt;nested switch statements&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;You can use one swicth statement inside another switch statement(s).&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The ? : Operator:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;We have covered&amp;nbsp;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_conditional_operator.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;conditional operator ? :&lt;/a&gt;&amp;nbsp;in previous chapter which can be used to replace&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;if...else&lt;/b&gt;&amp;nbsp;statements. It has the following general form:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Exp1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;?&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Exp2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Exp3&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The value of a ? expression is determined like this: Exp1 is evaluated. If it is true, then Exp2 is evaluated and becomes the value of the entire ? expression. If Exp1 is false, then Exp3 is evaluated and its value becomes the value of the expression.&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-decision-making-statements.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-1946899574938484194</guid><pubDate>Tue, 21 Apr 2015 15:44:00 +0000</pubDate><atom:updated>2015-04-21T21:14:13.042+05:30</atom:updated><title>C++ Loop Types</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There may be a situation, when you need to execute a block of code several number of times. In general statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Programming languages provide various control structures that allow for more complicated execution paths.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A loop statement allows us to execute a statement or group of statements multiple times and following is the general from of a loop statement in most of the programming languages:&lt;/div&gt;&lt;center style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;img alt=&quot;Loop Architecture&quot; src=&quot;http://www.tutorialspoint.com/cplusplus/images/loop_architecture.jpg&quot; style=&quot;box-sizing: border-box; display: block; margin-left: auto; margin-right: auto; max-width: 100%; padding-bottom: 4px; vertical-align: middle;&quot; /&gt;&lt;/center&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ programming language provides the following types of loop to handle looping requirements. Click the following links to check their detail.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;30%&quot;&gt;Loop Type&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_while_loop.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ while loop&quot;&gt;while loop&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_for_loop.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ for loop&quot;&gt;for loop&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Execute a sequence of statements multiple times and abbreviates the code that manages the loop variable.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_do_while_loop.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ do...while loop&quot;&gt;do...while loop&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Like a while statement, except that it tests the condition at the end of the loop body&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_nested_loops.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ nested loops&quot;&gt;nested loops&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;You can use one or more loop inside any another while, for or do..while loop.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Loop Control Statements:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ supports the following control statements. Click the following links to check their detail.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;30%&quot;&gt;Control Statement&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_break_statement.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ break statement&quot;&gt;break statement&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Terminates the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;loop&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;switch&lt;/b&gt;&amp;nbsp;statement and transfers execution to the statement immediately following the loop or switch.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_continue_statement.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ continue statement&quot;&gt;continue statement&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; color: black; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_goto_statement.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;C++ goto statement&quot;&gt;goto statement&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Transfers control to the labeled statement. Though it is not advised to use goto statement in your program.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The Infinite Loop:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A loop becomes infinite loop if a condition never becomes false. The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;for&lt;/b&gt;&amp;nbsp;loop is traditionally used for this purpose. Since none of the three expressions that form the for loop are required, you can make an endless loop by leaving the conditional expression empty.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;      printf&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;This loop will run forever.\n&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the conditional expression is absent, it is assumed to be true. You may have an initialization and increment expression, but C++ programmers more commonly use the for(;;) construct to signify an infinite loop.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;NOTE:&lt;/b&gt;&amp;nbsp;You can terminate an infinite loop by pressing Ctrl + C keys.&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-loop-types.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-4515031489557187299</guid><pubDate>Tue, 21 Apr 2015 15:43:00 +0000</pubDate><atom:updated>2015-04-21T21:13:31.929+05:30</atom:updated><title>Operators in C++</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C++ is rich in built-in operators and provides the following types of operators:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Arithmetic Operators&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Relational Operators&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Logical Operators&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Bitwise Operators&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Assignment Operators&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Misc Operators&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This chapter will examine the arithmetic, relational, logical, bitwise, assignment and other operators one by one.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Arithmetic Operators:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are following arithmetic operators supported by C++ language:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Assume variable A holds 10 and variable B holds 20, then:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_arithmatic_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Arithmetic Operators in C++&quot;&gt;Show Examples&lt;/a&gt;&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;10%&quot;&gt;Operator&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;45%&quot;&gt;Description&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Example&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;+&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Adds two operands&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A + B will give 30&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;-&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Subtracts second operand from the first&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A - B will give -10&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;*&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Multiplies both operands&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A * B will give 200&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;/&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Divides numerator by de-numerator&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;B / A will give 2&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;%&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Modulus Operator and remainder of after an integer division&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;B % A will give 0&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;++&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_increment_decrement_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Increment operator in C++&quot;&gt;Increment operator&lt;/a&gt;, increases integer value by one&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A++ will give 11&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;--&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_increment_decrement_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Decrement operator in C++&quot;&gt;Decrement operator&lt;/a&gt;, decreases integer value by one&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A-- will give 9&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Relational Operators:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are following relational operators supported by C++ language&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Assume variable A holds 10 and variable B holds 20, then:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_relational_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Relational Operators in C++&quot;&gt;Show Examples&lt;/a&gt;&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;10%&quot;&gt;Operator&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;45%&quot;&gt;Description&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Example&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;==&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Checks if the values of two operands are equal or not, if yes then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A == B) is not true.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;!=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Checks if the values of two operands are equal or not, if values are not equal then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A != B) is true.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A &amp;gt; B) is not true.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A &amp;lt; B) is true.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A &amp;gt;= B) is not true.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A &amp;lt;= B) is true.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Logical Operators:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are following logical operators supported by C++ language&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Assume variable A holds 1 and variable B holds 0, then:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_logical_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Logical Operators in C++&quot;&gt;Show Examples&lt;/a&gt;&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;10%&quot;&gt;Operator&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;45%&quot;&gt;Description&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Example&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;&amp;amp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Called Logical AND operator. If both the operands are non-zero, then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A &amp;amp;&amp;amp; B) is false.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;||&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Called Logical OR Operator. If any of the two operands is non-zero, then condition becomes true.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A || B) is true.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;!&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true, then Logical NOT operator will make false.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;!(A &amp;amp;&amp;amp; B) is true.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Bitwise Operators:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Bitwise operator works on bits and perform bit-by-bit operation. The truth tables for &amp;amp;, |, and ^ are as follows:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;p&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;q&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;p &amp;amp; q&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;p | q&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;p ^ q&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;0&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Assume if A = 60; and B = 13; now in binary format they will be as follows:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A = 0011 1100&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;B = 0000 1101&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;-----------------&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A&amp;amp;B = 0000 1100&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A|B = 0011 1101&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A^B = 0011 0001&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;~A&amp;nbsp; = 1100 0011&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The Bitwise operators supported by C++ language are listed in the following table. Assume variable A holds 60 and variable B holds 13, then:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_bitwise_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Bitwise Operators in C++&quot;&gt;Show Examples&lt;/a&gt;&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;10%&quot;&gt;Operator&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;45%&quot;&gt;Description&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Example&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Binary AND Operator copies a bit to the result if it exists in both operands.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A &amp;amp; B) will give 12 which is 0000 1100&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;|&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Binary OR Operator copies a bit if it exists in either operand.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A | B) will give 61 which is 0011 1101&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;^&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Binary XOR Operator copies the bit if it is set in one operand but not both.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(A ^ B) will give 49 which is 0011 0001&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;~&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Binary Ones Complement Operator is unary and has the effect of &#39;flipping&#39; bits.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;(~A ) will give -61 which is 1100 0011 in 2&#39;s complement form due to a signed binary number.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;&amp;lt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A &amp;lt;&amp;lt; 2 will give 240 which is 1111 0000&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;&amp;gt;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A &amp;gt;&amp;gt; 2 will give 15 which is 0000 1111&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Assignment Operators:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are following assignment operators supported by C++ language:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_assignment_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Assignment Operators in C++&quot;&gt;Show Examples&lt;/a&gt;&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;10%&quot;&gt;Operator&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;45%&quot;&gt;Description&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Example&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Simple assignment operator, Assigns values from right side operands to left side operand&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C = A + B will assign value of A + B into C&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;+=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C += A is equivalent to C = C + A&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;-=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C -= A is equivalent to C = C - A&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;*=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C *= A is equivalent to C = C * A&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;/=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C /= A is equivalent to C = C / A&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;%=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C %= A is equivalent to C = C % A&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;&amp;lt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left shift AND assignment operator&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C &amp;lt;&amp;lt;= 2 is same as C = C &amp;lt;&amp;lt; 2&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;gt;&amp;gt;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Right shift AND assignment operator&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C &amp;gt;&amp;gt;= 2 is same as C = C &amp;gt;&amp;gt; 2&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Bitwise AND assignment operator&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C &amp;amp;= 2 is same as C = C &amp;amp; 2&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;^=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;bitwise exclusive OR and assignment operator&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C ^= 2 is same as C = C ^ 2&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;|=&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;bitwise inclusive OR and assignment operator&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;C |= 2 is same as C = C | 2&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Misc Operators&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are few other operators supported by C++ Language.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;15%&quot;&gt;Operator&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot; width=&quot;35%&quot;&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;sizeof&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_sizeof_operator.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;sizeof operator&lt;/a&gt;&amp;nbsp;returns the size of a variable. For example, sizeof(a), where a is integer, will return 4.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Condition ? X : Y&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_conditional_operator.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Conditional operator&lt;/a&gt;. If Condition is true ? then it returns value X : otherwise value Y&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;,&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_comma_operator.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Comma operator&lt;/a&gt;&amp;nbsp;causes a sequence of operations to be performed. The value of the entire comma expression is the value of the last expression of the comma-separated list.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;. (dot) and -&amp;gt; (arrow)&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_member_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Member operators&lt;/a&gt;&amp;nbsp;are used to reference individual members of classes, structures, and unions.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Cast&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_casting_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Casting operators&lt;/a&gt;&amp;nbsp;convert one data type to another. For example, int(2.2000) would return 2.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_pointer_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Pointer operator &amp;amp;&lt;/a&gt;&amp;nbsp;returns the address of an variable. For example &amp;amp;a; will give actual address of the variable.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;*&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_pointer_operators.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot;&gt;Pointer operator *&lt;/a&gt;&amp;nbsp;is pointer to a variable. For example *var; will pointer to a variable var.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Operators Precedence in C++:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Operator precedence determines the grouping of terms in an expression. This affects how an expression is evaluated. Certain operators have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator:&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;For example x = 7 + 3 * 2; here, x is assigned 13, not 20 because operator * has higher precedence than +, so it first gets multiplied with 3*2 and then adds into 7.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators will be evaluated first.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;&lt;a href=&quot;http://www.tutorialspoint.com/cplusplus/cpp_operators_precedence.htm&quot; style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/link-icon.png); background-origin: initial; background-position: 100% 50%; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: #313131; font-weight: bold; outline: none !important; padding-bottom: 2px; padding-right: 22px; text-decoration: none;&quot; title=&quot;Operators Precedence in C++&quot;&gt;Show Examples&lt;/a&gt;&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Category&amp;nbsp;&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Operator&amp;nbsp;&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Associativity&amp;nbsp;&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Postfix&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;() [] -&amp;gt; . ++ - - &amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Unary&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;+ - ! ~ ++ - - (type)* &amp;amp; sizeof&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Right to left&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Multiplicative &amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;* / %&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Additive &amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;+ -&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Shift &amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt;&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Relational &amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;lt; &amp;lt;= &amp;gt; &amp;gt;=&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Equality &amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;== !=&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Bitwise AND&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Bitwise XOR&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;^&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Bitwise OR&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;|&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Logical AND&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&amp;amp;&amp;amp;&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Logical OR&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;||&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Conditional&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;?:&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Right to left&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Assignment&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;= += -= *= /= %=&amp;gt;&amp;gt;= &amp;lt;&amp;lt;= &amp;amp;= ^= |=&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Right to left&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Comma&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;,&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Left to right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/operators-in-c.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-9062031105104030369</guid><pubDate>Tue, 21 Apr 2015 15:42:00 +0000</pubDate><atom:updated>2015-04-21T21:12:00.821+05:30</atom:updated><title>Storage Classes in C++</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A storage class defines the scope (visibility) and life-time of variables and/or functions within a C++ Program. These specifiers precede the type that they modify. There are following storage classes, which can be used in a C++ Program&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;auto&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;register&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;static&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;extern&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;mutable&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The auto Storage Class&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;auto&lt;/b&gt;&amp;nbsp;storage class is the default storage class for all local variables.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; mount&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;auto&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; month&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The example above defines two variables with the same storage class, auto can only be used within functions, i.e., local variables.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The register Storage Class&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;register&lt;/b&gt;&amp;nbsp;storage class is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and can&#39;t have the unary &#39;&amp;amp;&#39; operator applied to it (as it does not have a memory location).&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  miles&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The register should only be used for variables that require quick access such as counters. It should also be noted that defining &#39;register&#39; does not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register depending on hardware and implementation restrictions.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The static Storage Class&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;static&lt;/b&gt;&amp;nbsp;storage class instructs the compiler to keep a local variable in existence during the life-time of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The static modifier may also be applied to global variables. When this is done, it causes that variable&#39;s scope to be restricted to the file in which it is declared.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;In C++, when static is used on a class data member, it causes only one copy of that member to be shared by all objects of its class.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; cursor: default; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Function declaration&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; func&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;/* Global variable */&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;--)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;       func&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Function definition&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; func&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// local static variable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;++;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;i is &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;    std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot; and count is &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;i &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;and&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;is&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The extern Storage Class&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;extern&lt;/b&gt;&amp;nbsp;storage class is used to give a reference of a global variable that is visible to ALL the program files. When you use &#39;extern&#39; the variable cannot be initialized as all it does is point the variable name at a storage location that has been previously defined.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When you have multiple files and you define a global variable or function, which will be used in other files also, then&amp;nbsp;&lt;i style=&quot;box-sizing: border-box;&quot;&gt;extern&amp;nbsp;&lt;/i&gt;will be used in another file to give reference of defined variable or function. Just for understanding&amp;nbsp;&lt;i style=&quot;box-sizing: border-box;&quot;&gt;extern&amp;nbsp;&lt;/i&gt;is used to declare a global variable or function in another file.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The extern modifier is most commonly used when there are two or more files sharing the same global variables or functions as explained below.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;First File: main.cpp&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;extern&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; write_extern&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   count &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   write_extern&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Second File: support.cpp&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;extern&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; write_extern&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Count is &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; count &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;endl&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Here,&amp;nbsp;&lt;i style=&quot;box-sizing: border-box;&quot;&gt;extern&lt;/i&gt;&amp;nbsp;keyword is being used to declare count in another file. Now compile these two files as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;$g&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cpp support&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;cpp &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;o write&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;This will produce&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;write&lt;/b&gt;&amp;nbsp;executable program, try to execute&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;write&lt;/b&gt;&amp;nbsp;and check the result as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;./&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;write&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The mutable Storage Class&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;mutable&lt;/b&gt;&amp;nbsp;specifier applies only to class objects, which are discussed later in this tutorial. It allows a member of an object to override constness. That is, a mutable member can be modified by a const member function.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/storage-classes-in-c.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-3668879192041361511</guid><pubDate>Tue, 21 Apr 2015 15:41:00 +0000</pubDate><atom:updated>2015-04-21T21:11:01.308+05:30</atom:updated><title>C++ Modifier Types</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ allows the&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;char, int,&amp;nbsp;&lt;/b&gt;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;double&lt;/b&gt;&amp;nbsp;data types to have modifiers preceding them. A modifier is used to alter the meaning of the base type so that it more precisely fits the needs of various situations.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The data type modifiers are listed here:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;signed&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;unsigned&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;long&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;short&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The modifiers&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;signed, unsigned, long,&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;short&lt;/b&gt;&amp;nbsp;can be applied to integer base types. In addition,&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;signed&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;unsigned&lt;/b&gt;&amp;nbsp;can be applied to char, and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;long&lt;/b&gt;&amp;nbsp;can be applied to double.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The modifiers&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;signed&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;unsigned&lt;/b&gt;&amp;nbsp;can also be used as prefix to&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;long&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;short&lt;/b&gt;&amp;nbsp;modifiers. For example,&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;unsigned long int&lt;/b&gt;.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;C++ allows a shorthand notation for declaring&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;unsigned, short,&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;long&lt;/b&gt;&amp;nbsp;integers. You can simply use the word&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;unsigned, short,&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;long&lt;/b&gt;, without the int. The int is implied. For example, the following two statements both declare unsigned integer variables.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;unsigned&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; x&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;unsigned&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; y&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;To understand the difference between the way that signed and unsigned integer modifiers are interpreted by C++, you should run the following short program:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt; &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;/* This program shows the difference between&lt;br /&gt; * signed and unsigned integers.&lt;br /&gt;*/&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;short&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;           &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// a signed short integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;short&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;unsigned&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; j&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// an unsigned short integer&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   j &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;50000&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; j&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; j&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When this program is run, following is the output:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;15536&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;50000&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The above result is because the bit pattern that represents 50,000 as a short unsigned integer is interpreted as -15,536 by a short.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Type Qualifiers in C++&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;The type qualifiers provide additional information about the variables they precede.&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Qualifier&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Meaning&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;const&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Objects of type&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;const&lt;/b&gt;&amp;nbsp;cannot be changed by your program during execution&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;volatile&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;The modifier&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;volatile&lt;/b&gt;&amp;nbsp;tells the compiler that a variable&#39;s value may be changed in ways not explicitly specified by the program.&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;restrict&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;A pointer qualified by&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;restrict&lt;/b&gt;&amp;nbsp;is initially the only means by which the object it points to can be accessed. Only C99 adds a new type qualifier called restrict.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-modifier-types.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1559515759987320099.post-5881770876949766859</guid><pubDate>Tue, 21 Apr 2015 15:39:00 +0000</pubDate><atom:updated>2015-04-21T21:09:47.824+05:30</atom:updated><title>C++ Constants/Literals</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Constants refer to fixed values that the program may not alter and they are called&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;literals&lt;/b&gt;.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Constants can be of any of the basic data types and can be divided into Integer Numerals, Floating-Point Numerals, Characters, Strings and Boolean Values.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Again, constants are treated just like regular variables except that their values cannot be modified after their definition.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Integer literals:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;An integer literal can be a decimal, octal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, 0 for octal, and nothing for decimal.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;An integer literal can also have a suffix that is a combination of U and L, for unsigned and long, respectively. The suffix can be uppercase or lowercase and can be in any order.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Here are some examples of integer literals:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;212&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;         &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Legal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;215u&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Legal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0xFeeL&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Legal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;078&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;         &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Illegal: 8 is not an octal digit&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;032UU&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Illegal: cannot repeat a suffix&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following are other examples of various types of Integer literals:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;85&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;         &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// decimal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0213&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// octal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0x4b&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// hexadecimal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;         &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;30u&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// unsigned int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;30l&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// long&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;30ul&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// unsigned long&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Floating-point literals:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part. You can represent floating point literals either in decimal form or exponential form.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;While representing using decimal form, you must include the decimal point, the exponent, or both and while representing using exponential form, you must include the integer part, the fractional part, or both. The signed exponent is introduced by e or E.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Here are some examples of floating-point literals:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;3.14159&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;       &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Legal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;314159E-5L&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Legal&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;510E&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Illegal: incomplete exponent&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;210f&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;          &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Illegal: no decimal or exponent&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;e55          &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;// Illegal: missing integer or fraction&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Boolean literals:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are two Boolean literals and they are part of standard C++ keywords:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A value of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;true&lt;/b&gt;&amp;nbsp;representing true.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A value of&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;false&lt;/b&gt;&amp;nbsp;representing false.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You should not consider the value of true equal to 1 and value of false equal to 0.&lt;/div&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Character literals:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Character literals are enclosed in single quotes. If the literal begins with L (uppercase only), it is a wide character literal (e.g., L&#39;x&#39;) and should be stored in&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;wchar_t&lt;/b&gt;&amp;nbsp;type of variable . Otherwise, it is a narrow character literal (e.g., &#39;x&#39;) and can be stored in a simple variable of&lt;b style=&quot;box-sizing: border-box;&quot;&gt;char&lt;/b&gt;&amp;nbsp;type.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;A character literal can be a plain character (e.g., &#39;x&#39;), an escape sequence (e.g., &#39;\t&#39;), or a universal character (e.g., &#39;\u02C0&#39;).&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are certain characters in C++ when they are preceded by a backslash they will have special meaning and they are used to represent like newline (\n) or tab (\t). Here, you have a list of some of such escape sequence codes:&lt;/div&gt;&lt;table class=&quot;table table-bordered&quot; style=&quot;border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(221, 221, 221); box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px; margin-bottom: 20px; max-width: 100%; width: 604px;&quot;&gt;&lt;tbody style=&quot;box-sizing: border-box;&quot;&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Escape sequence&lt;/th&gt;&lt;th style=&quot;background: rgb(238, 238, 238); border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Meaning&lt;/th&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\\&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\ character&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\&#39;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&#39; character&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\&quot;&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;&quot; character&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\?&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;? character&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\a&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Alert or bell&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\b&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Backspace&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\f&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Form feed&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\n&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Newline&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\r&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Carriage return&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\t&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Horizontal tab&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\v&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Vertical tab&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\ooo&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Octal number of one to three digits&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;box-sizing: border-box;&quot;&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;\xhh . . .&lt;/td&gt;&lt;td style=&quot;border: 1px solid rgb(221, 221, 221); box-sizing: border-box; line-height: 1.42857143; padding: 8px; vertical-align: top;&quot;&gt;Hexadecimal number of one or more digits&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the example to show few escape sequence characters:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;Hello\tWorld\n\n&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;Hello&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;box-sizing: border-box; color: #7f0055;&quot;&gt;World&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;String literals:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;String literals are enclosed in double quotes. A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You can break a long line into multiple lines using string literals and separate them using whitespaces.&lt;/div&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Here are some examples of string literals. All the three forms are identical strings.&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;hello, dear&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;hello, \&lt;br /&gt;&lt;br /&gt;dear&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;hello, &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;d&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&quot;ear&quot;&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;Defining Constants:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;There are two simple ways in C++ to define constants:&lt;/div&gt;&lt;ul class=&quot;list&quot; style=&quot;box-sizing: border-box; color: #313131; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 22px;&quot;&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Using&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;#define&lt;/b&gt;&amp;nbsp;preprocessor.&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;background-attachment: initial; background-clip: initial; background-image: url(http://cdn.tutorialspoint.com/images/icon-bullet.png); background-origin: initial; background-position: 0px 4px; background-repeat: no-repeat; background-size: initial; box-sizing: border-box; color: black; line-height: 24px; list-style: none; margin-bottom: 5px; padding: 0px 0px 0px 19px;&quot;&gt;&lt;div style=&quot;box-sizing: border-box; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Using&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;const&lt;/b&gt;&amp;nbsp;keyword.&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The #define Preprocessor:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following is the form to use #define preprocessor to define a constant:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; identifier value&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following example explains it in detail:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; LENGTH &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;   &lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; WIDTH  &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#define&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; NEWLINE &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;\n&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;br /&gt;   &lt;br /&gt;   area &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; LENGTH &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; WIDTH&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; NEWLINE&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;50&lt;/span&gt;&lt;/pre&gt;&lt;h2 style=&quot;box-sizing: border-box; color: #121214; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 1.7em; font-weight: normal; left: 0px; letter-spacing: -1px; line-height: 1.5em; margin: 0.2em 0.2em 0.2em 0px; padding: 0px; position: relative; text-shadow: rgb(204, 204, 204) 1px 1px 2px;&quot;&gt;The const Keyword:&lt;/h2&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;You can use&amp;nbsp;&lt;b style=&quot;box-sizing: border-box;&quot;&gt;const&lt;/b&gt;&amp;nbsp;prefix to declare constants with a specific type as follows:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; type variable &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; value&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Following example explains it in detail:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate tryit prettyprinted&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: rgb(238, 238, 238) !important; background-image: url(http://www.tutorialspoint.com/cplusplus/images/try-it.jpg) !important; background-origin: initial !important; background-position: 100% 0%; background-repeat: no-repeat !important; background-size: initial !important; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;box-sizing: border-box; color: #880000;&quot;&gt;#include&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&amp;lt;iostream&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;using&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; std&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; main&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  LENGTH &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  WIDTH  &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;const&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;char&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; NEWLINE &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;box-sizing: border-box; color: #008800;&quot;&gt;&#39;\n&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;  &lt;br /&gt;   &lt;br /&gt;   area &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; LENGTH &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; WIDTH&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; area&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   cout &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; NEWLINE&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;   &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;box-sizing: border-box; color: #000088;&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;box-sizing: border-box; color: #666600;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;When the above code is compiled and executed, it produces the following result:&lt;/div&gt;&lt;pre class=&quot;prettyprint notranslate prettyprinted&quot; style=&quot;background-color: #eeeeee; border-radius: 0px; border: 1px solid rgb(214, 214, 214); box-sizing: border-box; color: #313131; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 12px; line-height: 16px; margin-bottom: 10px; overflow: auto; padding: 5px; width: 604px;&quot;&gt;&lt;span class=&quot;lit&quot; style=&quot;box-sizing: border-box; color: #006666;&quot;&gt;50&lt;/span&gt;&lt;/pre&gt;&lt;div style=&quot;box-sizing: border-box; font-family: &#39;Open Sans&#39;, Arial, sans-serif; font-size: 14px; line-height: 24px; margin: 0em 0.2em 1em; padding: 0px; text-align: justify; word-wrap: break-word;&quot;&gt;Note that it is a good programming practice to define constants in CAPITALS.&lt;/div&gt;&lt;/div&gt;</description><link>http://siry-blogz.blogspot.com/2015/04/c-constantsliterals.html</link><author>noreply@blogger.com (siry blogz)</author><thr:total>0</thr:total></item></channel></rss>