{"id":10033,"date":"2018-02-15T12:12:20","date_gmt":"2018-02-15T06:42:20","guid":{"rendered":"http:\/\/mycbseguide.com\/blog\/?p=10033"},"modified":"2018-03-17T15:17:51","modified_gmt":"2018-03-17T09:47:51","slug":"using-c-constructs-class-11-notes-computer-science","status":"publish","type":"post","link":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/","title":{"rendered":"Using CPP constructs class 11 Notes Computer Science"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#CBSE_Guide_Using_CPP_constructs_class_11_Notes\" >CBSE Guide \u00a0Using CPP constructs class 11 Notes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#Using_CPP_constructs_class_11_Notes_Computer_Science\" >Using CPP constructs class 11 Notes Computer Science<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#Download_Revision_Notes_as_PDF\" >Download Revision Notes as PDF<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#_Using_C_constructs_class_11_Notes\" >\u00a0Using C++ constructs class 11 Notes<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#CBSE_Class-11_Revision_Notes_and_Key_Points\" >CBSE Class-11 Revision Notes and Key Points<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<p>CBSE Computer Science Chapter 5 Using CPP constructs class 11 Notes Computer Science in PDF are available for free download in myCBSEguide mobile app. The best app for CBSE students now provides \u00a0Using CPP constructs class 11 Notes Computer Science latest chapter wise notes for quick preparation of CBSE exams and school based annual examinations. Class 11 Computer Science notes on Chapter 5\u00a0 Using CPP constructs class 11 Notes Computer Science are also available for download in CBSE Guide website.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"CBSE_Guide_Using_CPP_constructs_class_11_Notes\"><\/span><strong>CBSE Guide \u00a0Using CPP constructs class 11 Notes<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>CBSE guide notes are the comprehensive notes which covers the latest syllabus of CBSE and NCERT. It includes all the topics given in NCERT class 11 Computer Science text book. Users can download CBSE guide quick revision notes from myCBSEguide mobile app and my CBSE guide website.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Using_CPP_constructs_class_11_Notes_Computer_Science\"><\/span><strong>Using CPP constructs class 11 Notes Computer Science<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Download CBSE class 11th revision notes for Chapter 5\u00a0 Using CPP constructs class 11 Notes Computer Science in PDF format for free. Download revision notes for \u00a0Using CPP constructs class 11 Notes Computer Science and score high in exams. These are the \u00a0Using CPP constructs class 11 Notes Computer Science prepared by team of expert teachers. The revision notes help you revise the whole chapter in minutes. Revising notes in exam days is on of the best tips recommended by teachers during exam days.<\/p>\n<h1 style=\"text-align: center\"><span class=\"ez-toc-section\" id=\"Download_Revision_Notes_as_PDF\"><\/span><a href=\"https:\/\/mycbseguide.com\/downloads\/cbse-class-11-computer-science\/1852\/cbse-revision-notes\/7\/\"><strong>Download Revision Notes as PDF<\/strong><\/a><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p style=\"text-align: center\"><strong>CBSE Class 11 Computer Science<br \/>\nRevision Notes<br \/>\nUsing C++ constructs<br \/>\nChapter -5<\/strong><\/p>\n<hr \/>\n<p><strong>Using C++ constructs Objectives:<\/strong><br \/>\n\u2022 to analyze syntaxes of various programming constructs available in C++.<br \/>\n\u2022 to draw comparison between various programming constructs.<br \/>\n\u2022 to apply the syntax of various programming constructs in problem solving<\/p>\n<p><strong>2.1 Categories of available constructs<\/strong><br \/>\nAfter exploring into various types of flow of control \/ logic in different programming situations let us go through the detailed syntax\/format of each of the programming constructs available in C++, using which we can monitor flow of control in our program. Here is one diagram which categorizes C++ constructs in detail:<br \/>\n<img decoding=\"async\" id=\"Picture 1\" src=\"https:\/\/media-mycbseguide.s3.amazonaws.com\/images\/static\/revise\/11\/computer\/ch4b\/image001.jpg\" \/><br \/>\nLet us deal each one of them one after another in detail.<\/p>\n<p><strong>2.1 Conditional Constructs:<br \/>\n2.1.1: Simple If ( )<\/strong><br \/>\nsyntax:<br \/>\nif (&lt;conditional expression \/ logical statement&gt;)<br \/>\n{<br \/>\n\/\/ statements to be executed when logical statement is satisfied<br \/>\n\/\/ i.e. when the logical statement yields a true value<br \/>\n}<br \/>\npoints to remember:<br \/>\ni) a logical statement always evaluates as true \/ false.<br \/>\nii) any value in C++ other than zero (positive \/ negative) is considered to be true whereas a zero (0) is considered to be false.<br \/>\niii) &lt; &gt; in syntax is known as a place holder, do not type it while writing program. It only signifies that any thing being kept there varies from program to program.<br \/>\niv) if there exists only one line of program statement under if( ) scope then we may ommit curly braces { }<\/p>\n<p>The statement kept under simple if ( ) gets executed only when the conditional expression\/logical statement under it is evaluated as true.<br \/>\nExamples :<br \/>\nint x = 1,<br \/>\ny = 3; x += y;<br \/>\nif ( x &gt; y )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dx is greater\u201d;<br \/>\n}<br \/>\nIn the above example the conditional statement under if ( ) will be always evaluated as true because the value of x will become 4 before the comparison thus the expression 4 &gt; 3 yields a true value letting the statement under if( ) to execute i.e. the output of the above code snippet would be \u201c x is greater \u201d<\/p>\n<p><strong>Workout yourself:<\/strong><br \/>\nConvert the above code snippet into a program in your practical period and execute it, verify the output.<br \/>\nNow change the initial value of x to 0 instead of 1 i.e. Change x = 0 in the program. Execute the<\/p>\n<p><strong>2.1.2: Compound If ( ): if &#8211; else combination<\/strong><br \/>\nsyntax:<br \/>\nif (&lt; conditional statement &gt;)<br \/>\n{<br \/>\n\/\/ statements to be executed when logical statement is satisfied<br \/>\n\/\/ i.e. when the logical statement yields a true value<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/ statements to be executed when logical statement is not satisfied<br \/>\n\/\/ i.e. when the logical statement yields a false value<br \/>\n}<br \/>\nExample:<br \/>\nint x = 0,<br \/>\ny = 3; x += y;<br \/>\nif (x &gt; y)<br \/>\n{<br \/>\ncout&lt;&lt;\u201dx is greater\u201d;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\ncout&lt;&lt;\u201dwe are in else part because x and y both became equal.\u201d;<br \/>\n}<br \/>\nThe above code snippet (portion) has two different paths of execution. If the conditional statement under if( ) is evaluated to be true then the statement under if ( ) block will be executed otherwise the statements under else block would be executed. The above code produces an output as \u201cwe are in else part because x and y both became equal.\u201d because the conditional statement under if ( ) evaluates as false as x is not greater than y, it is same as that of y.<\/p>\n<p><strong>Workout yourself:<\/strong><br \/>\nIn the above code snippet modify the logical statement under if ( ) such that the if ( ) block gets executed instead of else( ) block. You should not modify the initial values of x and y or change number of variables in the program.<\/p>\n<p><strong>2.1.3: Complex If ( ): if &#8211; else ladder<\/strong><br \/>\nsyntax:<br \/>\nif (&lt;condition -1&gt;)<br \/>\n{<br \/>\n\/\/ do something if condition-1 is satisfied<br \/>\n}<br \/>\nelse if (&lt;condition &#8211; 2 &gt;)<br \/>\n{<br \/>\n\/\/ do something if condition -2 is satisfied<br \/>\n}<br \/>\nelse if (&lt;condition &#8211; 3 &gt;)<br \/>\n{<br \/>\n\/\/ do something if condition- 3 is satisfied<br \/>\n}<br \/>\n:<br \/>\n: \/\/ many more n-1 else &#8211; if ladder may come<br \/>\n:<br \/>\nelse if( &lt; condition &#8211; n &gt;)<br \/>\n{<br \/>\n\/\/ do something if condition &#8211; n is satisfied<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/ at last do here something when none of the above else-if( )<br \/>\n\/\/conditions gets satisfied.<br \/>\n}<\/p>\n<p>In the above syntax there are ladder of multiple conditions presented by each if( ) , all of these conditions are mutually exclusive that is only one of them would get satisfied and all the conditions below it would not be evaluated and is discarded.<br \/>\nSay suppose if condition-3 gets satisfy i.e. it yields a true value for the condition, the statement under the block of third if( ) gets executed and all other n number of if( ) conditions below it would be discarded.<br \/>\nIf none of the n if ( ) conditions gets satisfied then the last else part always gets executed. It is not compulsory to add an else at the last of the ladder.<br \/>\nExample:<br \/>\nchar ch = getch( );<br \/>\nif (ch &gt;= &#8216;a&#8217; &amp;&amp; ch &lt;= &#8216;z&#8217;)<br \/>\n{<br \/>\ncout&lt;&lt;\u201dyou have inputted a lowercase alphabet\u201d;<br \/>\n}<br \/>\nelse if ( ch &gt;= &#8216;A&#8217; &amp;&amp; ch &lt;= &#8216;Z&#8217; )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dyou have inputted an uppercase alphabet\u201d;<br \/>\n}<br \/>\nelse if ( ch &gt; &#8216;0&#8217; &amp;&amp; ch &lt;= &#8216;9&#8217; )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dyou have inputted a digit\u201d;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\ncout&lt;&lt;\u201dyou have inputted any special character or symbol\u201d;<br \/>\n}<br \/>\nIn above code snippet a character is being inputted from user and is being checked upon by various if ( ) condition as alphabets, digit or any other special symbol. If the first condition gets satisfied then the character inputted is a lower case alphabet, if not then the second if ( ) is evaluated , if the second if( ) gets satisfied then the character is an upper case alphabet, if not then the third if ( ) is being evaluated , if it is satisfied then the character is a digit if not then finally it is inferred as any other symbol in the last else( ) .<br \/>\nThe benefit of this type of conditioning statement is that we can have multiple conditions instead of just having one or two as seen in case of earlier if( ) constructs.<\/p>\n<p><strong>Workout yourself:<\/strong><br \/>\nA date in the format of dd\/mm\/yyyy when dd, mm, and yyyy are inputted separately is said to be a valid date if it is found in a particular year&#8217;s calendar. For example 22\/12\/2012, 29\/02\/2012 are valid dates in calendar of 2012, but 31\/06\/2012 or 30\/02\/2012 are invalid dates in calendar of 2012.<br \/>\nFind out how many ladders of if( ) conditions would be required to write a program for checking validity of a date.<br \/>\nDiscuss your answer with your teacher.<\/p>\n<p><strong>2.1.4: Nested if-else<\/strong><br \/>\nYou might have seen a crow&#8217;s nest or any other bird&#8217;s nest, the materials being used to build the nest are enclosed within one another to give ample support to the nest.<br \/>\nWe also have the same concept of nesting of constructs within one another, to give ample strength to our program in terms of robustness , flexibility and adaptability (these terms you have learned in Unit &#8211; 3 earlier. )<br \/>\nWe are now considering nesting of an if ( ) construct within another if ( ) construct i.e one if( ) is enclosed within the scope of another if( ). The construct thus formed is called nested if( ). Let me show you few of the syntax forms of nested if( ) :<br \/>\nSyntaxes: Simple if ( ) nested within scope of another simple if ( )<br \/>\nif ( &lt;outer- condition &gt; )<br \/>\n{<br \/>\nif ( &lt;inner-condition&gt; )<br \/>\n{<br \/>\n\/\/some statements to be executed<br \/>\n\/\/ on satisfaction of inner if ( ) condition.<br \/>\n} \/\/ end of scope of inner if( )<br \/>\n\/\/some statements to be executed<br \/>\n\/\/ on satisfaction of inner if ( ) condition.<br \/>\n} \/\/ end of the scope of outer if( )<\/p>\n<p><strong>compound if ( ) nested within scope of another compound if ( )<\/strong><br \/>\nif ( &lt;outer- condition &gt; )<br \/>\n{<br \/>\nif ( &lt;inner-condition&gt; )<br \/>\n{<br \/>\n\/\/some statements to be executed<br \/>\n\/\/ on satisfaction of inner if ( ) condition.<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/ statements on failure of inner if( )<br \/>\n}<br \/>\n\/\/some statements to be executed<br \/>\n\/\/ on satisfaction of outer if ( ) condition.<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/ statements on failure of outer if( )<br \/>\n}<\/p>\n<p><strong>Ladder if-else-if ( ) nested within scope of another ladder if-else-if ( )<\/strong><br \/>\nif ( &lt;outer- condition-1 &gt; )<br \/>\n{<br \/>\nif ( &lt;inner-condition &#8211; 1&gt; )<br \/>\n{<br \/>\n\/\/some statements to be executed<br \/>\n\/\/ on satisfaction of inner if ( ) condition.<br \/>\n}<br \/>\nelse if ( &lt;inner-condition &#8211; 2&gt; )<br \/>\n{<br \/>\n\/\/ statements on failure of inner if( )<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/ last statement of the inner ladder if-else-if<br \/>\n\/\/some statements to be executed<br \/>\n\/\/ on satisfaction of inner if ( ) condition.<br \/>\n}<br \/>\nelse if ( &lt;outer-condition-2 &gt;)<br \/>\n{<br \/>\n\/\/ statements on failure of outer if( )<br \/>\n}<br \/>\nLike this you may try to keep any type if( ) construct within the scope of other type of if ( ) construct as desired by the flow of logic of that program.<\/p>\n<p><strong>Workout yourself:<\/strong><br \/>\ni) Try to nest simple if ( ) upto 4 levels<br \/>\nii) Try to nest complex if within a compound if ( )<br \/>\niii) Try to nest three simple if ( ) within another simple if( )<br \/>\nlet us now explore few example programs using various if( ) constructs:<\/p>\n<p><strong>program 2.1<\/strong><br \/>\n\/\/ program to compare three integer values to find highest out of them<br \/>\n#include&lt;iostream.h&gt;<br \/>\nvoid main( )<br \/>\n{<br \/>\nint n1= n2 = n3 = 0;<br \/>\ncout&lt;&lt;\u201dInput three integers\u201d;<br \/>\nif( n1 &gt; n2 &amp;&amp; n1 &gt; n3)<br \/>\ncout&lt;&lt;n1 &lt;&lt; &#8221; is the highest value\u201d;<br \/>\nelse if( n2 &gt;n1 &amp;&amp; n2 &gt; n3)<br \/>\ncout&lt;&lt; n2 &lt;&lt; &#8221; is the highest value\u201d;<br \/>\nelse if ( n3 &gt; n1 &amp;&amp; n3 &gt; n2 )<br \/>\ncout&lt;&lt; n3 &lt;&lt; &#8220;is the highest value\u201d;<br \/>\nelse<br \/>\ncout&lt;&lt; &#8220;all values are equal\u201d;<br \/>\n}<br \/>\nExplanation:<br \/>\nLets parse the logic of the above code (shaded area) to understand it using a dry run:<br \/>\nCase &#8211; I<br \/>\nlet us assume that the value of n1 = 1, n2 = 5 and n3 = -7<br \/>\nevaluation of the first if( ) in the ladder:<br \/>\nif(n1 &gt; n2 &amp;&amp; n1 &gt; n3)<br \/>\n==&gt; if(1 &gt; 5 &amp;&amp; 1 &gt; -7)<br \/>\n==&gt; if(false &amp;&amp; true)<br \/>\n==&gt; if(false) \/\/ as per truth table of logical and (&amp;&amp;) operator<br \/>\nsince the first condition is evaluated as false so the next condition in the ladder would be evaluated<br \/>\nif(n2 &gt; n1 &amp;&amp; n2 &gt; n3)<br \/>\n==&gt; if (5 &gt; 1 &amp;&amp; 5 &gt; -7)<br \/>\n==&gt; if (true &amp;&amp; true)<br \/>\n==&gt; if(true) \/\/ as per truth table of logical and (&amp;&amp;) operator<br \/>\nsince the second logic is evaluated as true, it open the block of second if( ) and the statements under the second else-if ( ) block gets executed and an output is printed on the console as :<br \/>\n\u201c5 is highest value\u201d<\/p>\n<p><strong>Workout yourself:<\/strong><br \/>\ni) Try to execute the above program 2.1 using dry run method with values n1 = 1 , n2 = 1 and n3 = 1<br \/>\nii) Try to implement the above program using any other type of if( ) construct<\/p>\n<p><strong>program 2.2<\/strong><br \/>\n\/\/program to find whether a 4 digit inputted year is a leap year<br \/>\n#include&lt;iostream.h&gt;<br \/>\nvoid main( )<br \/>\n{<br \/>\nint year = 0;<br \/>\ncout&lt;&lt;\u201dInput a 4 digit year\u201d; cin&gt;&gt; year;<br \/>\nif ( year % 4 == 0 )<br \/>\n{<br \/>\nif ( year % 100 == 0 )<br \/>\n{<br \/>\nif( year % 400 == 0)<br \/>\n{<br \/>\ncout&lt;&lt; \u201cYear : \u201c &lt;&lt; year &lt;&lt;\u201d is a leap year\u201d;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\ncout&lt;&lt;\u201dYear : \u201c&lt;&lt; year &lt;&lt; \u201c is not a leap year\u201d;<br \/>\n}<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\ncout&lt;&lt;\u201cYear : \u201c &lt;&lt; year &lt;&lt;\u201d is a leap year\u201d;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\ncout&lt;&lt;\u201dYear : \u201c&lt;&lt; year &lt;&lt; \u201c is not a leap year\u201d;<br \/>\n}<br \/>\n} \/\/ end of main ( )<br \/>\nThe above program is a very good example showing the use of nesting of if( ).<\/p>\n<p><strong>Explanation:<\/strong><br \/>\nLet us first understand which year would be called leap year, a leap is a year which:<br \/>\ni) is divisible by 4 but not divisible by 100<br \/>\nii) is divisible by 4 as well as divisible by 100 and at the same time divisible by 400<br \/>\nAny other criteria will make the year as a non-leap year candidate.<br \/>\nDry Run -1<br \/>\nLet us parse the gray area code of the above program with a dry run having year = 1994<br \/>\nif(1994 % 4 == 0)<br \/>\n==&gt; if(2 == 0)<br \/>\n==&gt; if(false)<br \/>\nSince the first if condition is not satisfied the flow of the program proceeds to its else block and prints the output as \u201c Year: 1994 is not a leap year\u201d<br \/>\nDry Run &#8211; 2:<br \/>\nLet us parse the gray area code of the above program with a dry run having year = 2000<br \/>\nif(2000 % 4 == 0)<br \/>\n==&gt; if(0 == 0)<br \/>\n==&gt; if(true)<br \/>\nSince the first condition evaluates out to be true it opens up its block and the next statement in the inner block gets executed as:<br \/>\n==&gt; if(2000 % 100 == 0)<br \/>\n==&gt; if(0 == 0)<br \/>\n==&gt; if(true)<br \/>\nSince the first nested if ( ) condition evaluates out to be true it opens up its block and the next statement in the inner block is continues as :<br \/>\n==&gt; if(2000 % 400 == 0)<br \/>\n==&gt; if(0 == 0)<br \/>\n==&gt; if(true)<\/p>\n<p>Since the second nested if ( ) condition evaluates out to be true it opens up its block and the next statement in the inner block is continues to print output on console as :<br \/>\n\u201cYear: 2000 is a leap year\u201d<\/p>\n<p><strong>Workout yourself:<\/strong><br \/>\ni) Google out to find that whether year 1900 was a leap year or not and then verify it using a dry run with the help of above program.<br \/>\nii) Try to implement the above code without using nested if ( ) construct.<\/p>\n<p><strong>Check your progress:<br \/>\n1. Find error in code below and explain.<\/strong><br \/>\n#include&lt;iostream.h&gt;<br \/>\nvoid main()<br \/>\n{<br \/>\nint x = 5;<br \/>\nif( x &gt; 5 )<br \/>\n{<br \/>\nx += 5;<br \/>\nint y = 8;<br \/>\n}<br \/>\ny += x;<br \/>\n}<\/p>\n<p><strong>2. Find the output of the code below:<br \/>\nvoid main( )<\/strong><br \/>\n{<br \/>\nint NoOfGirls = 4;<br \/>\nint NoOfBoys = 10;<br \/>\nif (NoOfBoys = 8 &amp;&amp; NoOfGirls &lt;= NoOfBoys )<br \/>\ncout&lt;&lt;\u201dGreat achievement\u201d;<br \/>\nelse<br \/>\ncout&lt;&lt;\u201dGreater achievement\u201d;<br \/>\n}<\/p>\n<p><strong>3. Find the output of the code below:<br \/>\nvoid main( )<\/strong><br \/>\n{<br \/>\nint circle = 5 , rectangle = 0 , square = 4 , triangle = 0 ;<\/p>\n<p>if( circle)<br \/>\n{<br \/>\nif(rectangle || square )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dDraw diagram\u201d;<br \/>\n}<br \/>\nelse if( ! rectangle &amp;&amp; ! square )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dInvalid diagram\u201d;<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\nif( circle == rectangle || square == triangle )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dCanvas Available\u201d;<br \/>\n}<br \/>\n}<br \/>\n}<br \/>\ncout&lt;&lt;\u201dInvisible diagram\u201d;<br \/>\n}<\/p>\n<p><strong>4. Find the output of code below:<\/strong><br \/>\nvoid main( )<br \/>\n{<br \/>\nint x = 3 , y = 5;<\/p>\n<p>if( x &lt;= 5 );<\/p>\n<p>cout&lt;&lt;\u201dHurray\u201d;<\/p>\n<p>else<br \/>\ncout&lt;&lt;\u201d Trapped\u201d;<br \/>\n}<\/p>\n<p>5. Write a program which inputs day(dd) , month(mm) and year(yyyy) and checks whether\u00a0it is a valid date or not. [ A valid date must lie on the calendar ]\n<p>6. Dipu Jwellers gives discount on a fixed purchase total based on following criteria :<br \/>\nIf the purchase amount of a customer does not lies between the given purchase total then no discount should be given.<br \/>\nWrite a program to calculate the Bill amount of a purchase after giving proper discount.<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n<tbody>\n<tr>\n<td>Offer<\/td>\n<td>Offer Months<\/td>\n<td>Discount %<\/td>\n<td>Purchase total<\/td>\n<\/tr>\n<tr>\n<td>Winter Bonanza<\/td>\n<td>Oct to Feb<\/td>\n<td>30<\/td>\n<td>Between 3000 to 5000<\/td>\n<\/tr>\n<tr>\n<td>Summer Bonanza<\/td>\n<td>Mar to June<\/td>\n<td>20<\/td>\n<td>Between 10000 to 12000<\/td>\n<\/tr>\n<tr>\n<td>Monsoon Bonanza<\/td>\n<td>July to Sep<\/td>\n<td>10<\/td>\n<td>Between 2000 to 10000<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>2.1.5: switch-case statement<\/strong><br \/>\nswitch-case construct is a type of conditional construct which resembles the same flow of logic as that of ladder if-else-if with few exceptions. Let us observe the syntax of the switch-case construct of C++ :<br \/>\n<strong>Syntax :<\/strong><br \/>\nswitch ( &lt;switching variable | switch expression &gt;)<br \/>\n{<br \/>\ncase &lt;value-1&gt; :<br \/>\n\/\/do something if switching variable value matches with that of value-1<br \/>\nbreak;<\/p>\n<p>case &lt;value-2&gt; :<br \/>\n\/\/do something if switching variable value matches with that of value-2<br \/>\nbreak;<\/p>\n<p>case &lt; value-3&gt; :<br \/>\n\/\/do something if switching variable value matches<br \/>\n\/\/ with that of value-3<br \/>\nbreak;<br \/>\ncase &lt;value-n&gt; :<br \/>\n\/\/do something if switching variable value matches \u00a0with that of value-n<br \/>\nbreak;<\/p>\n<p>default :<br \/>\n\/\/do something if switching variable value does not matches with any value<br \/>\n\/\/between value-1 to value-n<br \/>\n}<br \/>\nA switch-case control matches a particular switching value in a switch variable or a value generated after evaluating an expression with several values, when it finds an exact match between switch variable value and case value it enters into that particular case to execute the statements under that case, and then on finding a break statement it jumps out of the case and then comes out of the scope of switch-case without considering other cases value.<br \/>\nExample:<br \/>\nint menu_choice = 0;<br \/>\ncin&gt;&gt;menu_choice ;<br \/>\nswitch (menu_choice)<br \/>\n{<br \/>\ncase 1 :<br \/>\ncout&lt;&lt; &#8220;press key &#8216;s&#8217; to start the game\u201d;<br \/>\nbreak;<\/p>\n<p>case 2 :<br \/>\ncout&lt;&lt;\u201dpress key &#8216;n&#8217; to navigate through game plan\u201d;<br \/>\nbreak;<\/p>\n<p>case 3 :<br \/>\ncout&lt;&lt;\u201dpress key &#8216;c&#8217; to change the level of the game\u201d;<br \/>\nbreak;<\/p>\n<p>case 4 :<br \/>\ncout&lt;&lt;\u201dpress key &#8216;f&#8217; to fast your speed\u201d;<br \/>\nbreak;<\/p>\n<p>case 5 :<br \/>\ncout&lt;&lt;\u201dpress key &#8216;x&#8217; to exit from game\u201d;<br \/>\nbreak;<\/p>\n<p>default :<br \/>\ncout&lt;&lt;\u201dyou have to choose between 1 to 5\u201d ;<br \/>\n}<\/p>\n<p>The above code implements a game menu design where inputted integer value in the switching variable menu_choice is being matched with values 1 to 5 , each value representing one game action.<br \/>\nYou may observe that the flow of the switch-case construct is same as ladder if-else-if construct, because it also deals with multiple paths of execution out of which a selected path gets executed. If none of the conditions gets satisfied then the statements under the default case gets executed.<br \/>\nPoints to remember while using a switch-case construct in a program :<br \/>\na) a break statement always ends a case, if break is not placed then all the cases\u00a0after the current case gets executed till a break statement is met.<br \/>\nb) a switch-case always matches its switch variable value with a single constant case\u00a0value, this case value must always be a single integer value or a single character. Floats and double values of switch variable are not valid. i.e. the code below is invalid code:<br \/>\nc) the cases in the switch cannot provide a range of values to be matched with the\u00a0switching variable i.e. we can&#8217;t write statements like &gt;= 4 &amp;&amp; &lt;= 9 with cases. The following code is invalid :<br \/>\nchar ch = &#8216;*&#8217; ;<\/p>\n<p>cin &gt;&gt; ch;<br \/>\nswitch(ch)<br \/>\n{<br \/>\ncase &gt;=&#8217;a&#8217; &amp;&amp; &lt;=&#8217;z&#8217;<br \/>\ncout&lt;&lt;\u201dYou have entered lowercase alphabet\u201d;<br \/>\nbreak;<\/p>\n<p>case &gt;= &#8216;A&#8217; &amp;&amp; &lt;= &#8216;Z&#8217;<br \/>\ncout&lt;&lt;\u201dYou have entered uppercase alphabet\u201d;<br \/>\nbreak;<br \/>\n}<br \/>\nThe above code gives us an example where ladder if-else-if has an advantage or switch- case, because we can have a logical statement having a range of values to be compared.<\/p>\n<p>d) The sequence of case value does not matters i.e. It is not compulsory to keep a lower case value as first case and the highest case value being the last case. They can exist in any order.<br \/>\ne) The default case is optional and should be always kept at the last place in switch-case construct<br \/>\nf) A switch-case construct can also be nested within another switch-case operator.<br \/>\nWorkout yourself :<br \/>\ni) Write a program which inputs a month number from user and then finds the total days present in that month. Use only switch-case construct. For example if user inputs month number as 2 then the program displays \u201cFebruary has 28 or 29 days\u201d.<br \/>\nii) Compare and contrast switch-case construct with ladder if-else-if construct in a tabular\u00a0form<\/p>\n<p><strong>2.1.6 : <\/strong>Conditional operator ( &lt; &gt; ? &lt;&gt; : &lt;&gt;)<br \/>\nConditional Operator is a small short hand operator in C++ which helps to implement flow of logic based on some condition like if-else construct. The syntax of the conditional operator is :<br \/>\n<strong>Syntax :<\/strong><br \/>\n&lt;logical expression&gt; ? &lt; true part &gt; : &lt; false part &gt; ;<br \/>\nThe logical expression in the operator gets evaluated either as true or false , if true then statement after symbol ( ? ) gets executed otherwise statement after symbol ( : ) gets executed. It acts much like an if ( ) &#8211; else construct but can only execute single statement. Like if-else the conditional operator\u00a0cannot have a block of code to execute in its true or false part.<br \/>\nWe often use conditional operator to implement a short one line conditional expression.<br \/>\n<strong>Example:<\/strong><br \/>\nint x = 5 , y = 7;<br \/>\nint result = ( x &gt; y ) ? 1 : 0;<br \/>\ncout&lt;&lt; result;<br \/>\nThe output of the above example would be 0 because the condition x &gt; y is not being satisfied , hence the value 0 is being assigned to result. A conditional operator can be also nested within another conditional operator.<br \/>\nWorkout yourself:<br \/>\nWrite a program using conditional operator to find the highest of three inputted integers.<br \/>\n[Hint : use nesting of conditional operator]\n<p>2.1.7 : Nesting of all conditional constructs<br \/>\nIn real life programming situations often all the conditional constructs are being used in a single program. Any of the conditional construct can be nested within any of the other construct. For example a switch-case construct can nest a ladder if-else-if within its scope, or each ladder condition of a ladder if-else-if may nest a switch-case construct within its scope. The following code snippet justifies this idea :<br \/>\nswitch( &lt; an expression&gt; )<br \/>\n{<br \/>\ncase &lt;value-1&gt; :<br \/>\nif( &lt; conndition -1 &gt;)<br \/>\n{<br \/>\n\/\/ some code<br \/>\n}<br \/>\nelse if (&lt; condition-2&gt;)<br \/>\n{<br \/>\n\/\/ some code<br \/>\n}<br \/>\nelse<br \/>\n{<br \/>\n\/\/ some code<br \/>\n}<br \/>\nbreak; case &lt;value-2 &gt;<br \/>\nif( &lt; condition -1 &gt;)<br \/>\n{<br \/>\n\/\/ some code<br \/>\n}<br \/>\nelse if (&lt; condition-2&gt;)<br \/>\n{<br \/>\n\/\/ some code<br \/>\nelse<br \/>\n{<br \/>\n\/\/ some code<br \/>\n}<br \/>\nbreak;<br \/>\n} \/\/ end of switch-case<br \/>\nSimilarly we can have :<br \/>\nif ( &lt;condition -1 &gt;)<br \/>\n{<br \/>\nswitch(var1)<br \/>\n{<br \/>\ncase &lt;value1&gt; :<br \/>\nbreak; case &lt;value2&gt;<br \/>\nbreak;<br \/>\ncase&lt;value-3&gt;<br \/>\nbreak;<br \/>\n}<br \/>\nelse if ( &lt;condition-2&gt;)<br \/>\n{<br \/>\nswitch(var1)<br \/>\n{<br \/>\ncase &lt;value1&gt; :<br \/>\nbreak; case &lt;value2&gt;<br \/>\nbreak;<br \/>\ncase&lt;value-3&gt;<br \/>\nbreak;<br \/>\n}<br \/>\n}<\/p>\n<p>Ask your teacher which of the constructs can be nested within which of the other constructs.<br \/>\nCheck Your Progress :<br \/>\n1. Find the output of the code given below :<br \/>\n#include&lt;iostream.h&gt; void main( )<br \/>\n{<br \/>\nint x = 3; switch(x)<br \/>\n{<br \/>\ncase 1 : cout&lt;&lt; \u201cOne\u201d; break; case 2 : cout&lt;&lt; \u201cTwo\u201d; break; case 3 : cout&lt;&lt; \u201cThree\u201d case 4 : cout&lt;&lt; \u201cFour\u201d; case 5: cout&lt;&lt; \u201cFive\u201d; break;<br \/>\n}<br \/>\n}<\/p>\n<p>2. Find error in following code :<br \/>\n#include&lt;isotream.h&gt; void main()<br \/>\n{<br \/>\nint a = 10; int b = 10; int c = 20;<br \/>\nswitch ( a ) { case b:<br \/>\ncout&lt;&lt;\u201dHurray B\u201d; break;<br \/>\ncase c:<br \/>\ncout&lt;&lt;\u201dHurray C\u201d; break;<br \/>\ndefault:<br \/>\ncout&lt;&lt;\u201dWrong code\u201d; break;<br \/>\n}<br \/>\n}<\/p>\n<p><strong>2.2 Iterative Constructs (Looping):<\/strong><br \/>\nIterative constructs or Loops enables a program with a cyclic flow of logic. Each statement which is written under the scope of a looping statement gets executed the number of times the iteration\/looping\u00a0continues for.<br \/>\nIn previous chapter we have seen few real life scenarios where a looping construct is needed for performing a particular set of tasks repeatedly for a number of times. Now we will go into details of all looping constructs available in C++.<br \/>\nIn C++ there are three basic types of looping constructs available, they are :<br \/>\n&#8211; while( ) loop \/\/ keyword while is used to loop<br \/>\n&#8211; do-while( ) loop \/\/ keywords do and while are used to loop<br \/>\n&#8211; for loop \/\/ keyword for is used to loop<br \/>\nIt is very important to understand that a looping construct enables repetition of tasks under its scope based on a particular condition called as loop-condition. This loop-condition evaluates as true or false. A loop may be continued till a loop-condition is evaluated as true or false, based on a particular program situation.<br \/>\nAll the above mentioned three loops have three parts common in them i.e.<br \/>\n&#8211; the looping variable ( iterator )<br \/>\n&#8211; the loop-condition<br \/>\n&#8211; logic to change the value of iterator with each cycle\/iteration<br \/>\nLet me show you distinguishably these three parts and then we will proceed to the syntax.<br \/>\n<img decoding=\"async\" id=\"Picture 3\" src=\"https:\/\/media-mycbseguide.s3.amazonaws.com\/images\/static\/revise\/11\/computer\/ch4b\/image003.jpg\" \/><br \/>\nSimilarly , while and do-while also have these three significant parts as shown below :<br \/>\nint i = 0 int i = 0;<br \/>\nwhile ( i&lt;= 7 )<br \/>\n{<br \/>\n\/\/ some code<br \/>\n}<br \/>\ndo<br \/>\n{<br \/>\n\/\/ some code \/<br \/>\n} while(i &lt;= 7 ) ;<br \/>\n<strong>2.2.1 : while( ) loop construct<\/strong><br \/>\nA while loop tests for its ending condition before performing its contents &#8211; even the first time. So if the ending condition is met when the while loop begins, the lines of instructions it contains will never be carried out.<br \/>\n<strong>Syntax :<\/strong><br \/>\nwhile (&lt;loop-condition&gt;)<br \/>\n{<br \/>\n\u2026. ]\n\u2026. ]\n}<br \/>\nA while continues iteration-cycle till its loop condition is evaluated as false. If the loop-condition is false for the first time iteration then loop will not execute even once.<br \/>\nExample :<br \/>\nint x = 0, sum = 0 ; cout&lt;&lt;\u201dInput a natural number\u201d; cin&gt;&gt;x;<\/p>\n<p>while(x &gt; 0 )<br \/>\n{<br \/>\nsum = sum + x; x &#8211; &#8211; ;<br \/>\n}<br \/>\ncout&lt;&lt;\u201dThe sum is :\u201d &lt;&lt; sum;<br \/>\nThe above code snippet finds the sum of n natural number using while loop. The loop is executed till the x is greater than 0 , as soon x becomes 0 the loop is terminated. We observe that within the scope of the loop the value of x is decremented so that it approaches to its next previous value. Thus with each iteration the value of x is added to a variable sum and is decremented by 1.<br \/>\nLets understand the above program with a Dry Run. Let us assume that user inputs a value 4 for x then at :<br \/>\n<strong>1st Iteration start<\/strong><br \/>\nx is 4 , sum = 0 i.e. the loop-condition 4 &gt; 0 is evaluated as true hence it opens up the while block ==&gt; sum = 0 + 4 = 4 x will be decremented by 1 , thus x = 3<br \/>\n<strong>2nd Iteration start<\/strong><br \/>\nx is 3 , sum = 4 i.e. the loop-condition 3 &gt; 0 is evaluated as true hence it opens up the while block ==&gt; sum = 4 + 3 = 7 x will be decremented by 1 , thus x = 2<br \/>\n<strong>3rd Iteration start<\/strong><br \/>\nx is 2 , sum = 7 i.e. the loop-condition 2 &gt; 0 is evaluated as true hence it opens up the while block ==&gt; sum = 7 + 2 = 9 x will be decremented by 1 , thus x = 1<br \/>\n<strong>4th Iteration start<\/strong><br \/>\nx is 1 , sum = 9 i.e. the loop-condition 1 &gt; 0 is evaluated as true hence it opens up the while block ==&gt; sum = 9 + 1 = 10 x will be decremented by 1 , thus x = 0 5th Iteration start<br \/>\nx is 0 , sum = 10 i.e. the loop-condition 0 &gt; 0 is evaluated as false because 0 == 0 hence it locks up the while block and while() loop is terminated.<br \/>\nThus coming out of while loop block the value of sum is printed as 10 loop executes for 4 times.<br \/>\nWorkout yourself :<br \/>\nConsider the program given below : void main( )<br \/>\n{<br \/>\nint x = 5, m = 1 , p = 0; while( p &lt;= 50 )<br \/>\n{<br \/>\np = x * m ; m++;<br \/>\n}<br \/>\n}<br \/>\nNow complete the following Iteration tracking table with details of each iteration, the first one is done for you :<br \/>\nIteration<br \/>\nloop-<br \/>\ncondition<br \/>\nx<br \/>\nP<br \/>\nm<br \/>\n1st Iteration<br \/>\n0&lt;= 50 ==&gt; true<br \/>\n5<br \/>\n5<br \/>\n2<br \/>\nCheck it out with your teacher.<br \/>\n<strong>Why my while loop is not getting executed ?<\/strong><br \/>\nIt is very important to understand here that in while loop the looping condition is evaluated at the beginning of the loop&#8217;s scope i.e. prior to the entering into scope of loop. This type of checking is called \u201cEntry Control Checking\u201d, if the condition fails this checking it will not be allowed into the scope of the loop. That is why while( ) loops are often called as \u201cEntry Control Loop\u201d. You can imagine a similar checking situation that your tickets are being checked prior to your entry into a cinema hall to view a film. You will not be able to view the film at all if you don&#8217;t have the tickets !!<br \/>\nSimilarly if the loop-condition fails at the first time itself the statements under the scope of loop will not run even once. Observe such a code scenario below :<br \/>\nnoOfPersons = 4; noOfTickets = 3 ;<br \/>\nwhile( noOfTickets &gt;= noOfPersons )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dWelcome to Gangs of C++ pure\u201d<br \/>\n}<br \/>\nThe above loop will not execute at all because the loop-condition is failing at first time.<\/p>\n<p><strong>2.2.2 : do-while( ) loop construct<\/strong><br \/>\nA do-while loop is identical to a while loop in every sense except that it is guaranteed to perform the instructions inside once before testing for the ending condition.<br \/>\n<strong>Syntax:<\/strong><br \/>\ndo<br \/>\n{<br \/>\n\/\/ do something ;<br \/>\n\/\/ do something ;<br \/>\n} while( &lt;loop-condition&gt; ) ;<br \/>\nExample: Consider the following code snippet to find factorial of a given number n :<br \/>\nint f = 1; int n = 0; cin&gt;&gt; n;<br \/>\ndo<br \/>\n{<br \/>\nf = f * n ;<br \/>\n&#8211; &#8211; n ;<br \/>\n} while( n &gt; 0 ) ;<br \/>\ncout &lt;&lt; \u201cThe factorial of : \u201c &lt;&lt; n &lt;&lt;\u201d is \u201c &lt;&lt;f ;<br \/>\nLets us analyze the execution of the above program : the factorial of any number n is evaluated as<br \/>\nfact = n * (n-1) * (n-2) * * 1<br \/>\nThis means that with each iteration the value of n is decremented by 1 and is multiplied with the previous value of n is stored cumulatively. The iteration-cycle stops when n is decremented upto a value equal to 1.<br \/>\nLet us conduct a Dry run on the above code snippet to understand the flow of logic for n = 4:<br \/>\nInitially<br \/>\nf =1, n = 4 1st Iteration-cycle:<br \/>\nf = 1 * 4 = 4 , n = 3, condition n &gt; 0 evaluates as true hence loop is continued 2nd Iteration-cycle :<br \/>\nf = 4 * 3 = 12 , n = 2 , condition n &gt; 0 evaluates as true hence loop is continued 3rd Iteration-cycle :<br \/>\nf = 12 * 2 = 24 , n = 1 , condition n &gt; 0 evaluates as true hence loop is continued 4th Iteration-cycle :<br \/>\nf = 24 * 1 = 24 , n = 0 , condition n &gt; 0 evaluates as false , as 0 == 0 hence loop is terminated and program flow comes out of the scope of the loop into program scope.<br \/>\nThe output is printed on console as:<br \/>\n\u201cThe factorial of : 0 is 24\u201d<br \/>\nWorkout yourself :<br \/>\nThough the above factorial code snippet has executed nicely and produced correct and valid result of factorial of 4 i.e. 24 but while prompting output to user it wrongly says that &#8220;factorial of :0 is 24\u201d . It must show that &#8220;factorial of 4 is 24\u201d.<br \/>\nFind out the reason for the above misprinting and correct the program by modifying the code so that it produces expected output prompt to user.<br \/>\nCheck your result with your teacher.<br \/>\nWhy my do-while() loop is getting executed once even when the condition is not satisfied!<br \/>\nIt is very important to understand here that in do-while loop the looping condition is evaluated at the end of the loop&#8217;s scope i.e. after the last statement in the scope of loop. This type of checking is called \u201cExit Control Checking\u201d, if the condition fails this checking it will not be allowed into the scope of the loop on next iteration-cycle. In the whole affair you are observing that the loop had executed at least once even when condition fails in 1st Iteration-cycle. That is why do-while( ) loops are often called as \u201cExit Control Loop\u201d. You can imagine a similar checking situation that your shopping bag items and purchase bill are being checked on your exit out of a shopping mall where you have been for shopping.<br \/>\nFor example consider the program 2.3 ahead.<br \/>\nSentinels:<br \/>\nOften a looping construct executes loop for a fixed number of times based on certain looping condition placed on the looping variable or the iterator, but sometimes the termination of loop is not fixed i.e. the termination of loop depends on some outside input. These types of loops where termination of loop is not fixed and depends on outside input are called sentinels.<br \/>\nFor example : Consider the program given below :<br \/>\n<strong>program 2.3<\/strong><br \/>\n\/\/ program to count number of adults and minors<br \/>\n#include&lt;iostream.h&gt; void main( )<br \/>\n{<br \/>\nint ad = 0 , m = 0;<br \/>\nint age = 0;<br \/>\ncout&lt;&lt; &#8220;Input age :\u201d;<br \/>\ncin&gt;&gt; age;<br \/>\nwhile(age &gt; 0)<br \/>\n{<br \/>\nif( age &gt;= 18 ) ad++ ;<br \/>\nelse<br \/>\nm++;<br \/>\ncout&lt;&lt; \u201cInput age :\u201d;<\/p>\n<p>cin&gt;&gt; age;<br \/>\n}<br \/>\ncout&lt;&lt; \u201cThere are total \u201c &lt;&lt; ad &lt;&lt;\u201d adults and\u201d &lt;&lt; m &lt;&lt; \u201cminors\u201d;<br \/>\n}<\/p>\n<p>Can you tell how many times the loop in above question runs ? Your answer would be probably \u201cNo\u201d , or better you will tell that since the termination of the loop depends upon the value of the variable age, it is not fixed that how many times the loop may run.<br \/>\nYes this is the feature a sentinel has , here the value of variable age controls the execution cycle of the while () loop. If the value of the age inputted by the used before the start of the loop is inputted as 0 then the loop will not be executed at all because the condition fails on the start of the first cycle itself. Moreover it also not fixed that after how many cycles the user may input a 0 value to stop the loop , he\/she may input after 3 cycles or 5 or may be 200 !<br \/>\nWorkout yourself:<br \/>\nIn the above program 2.3, remove the two shaded input line placed before the start of while () construct, and then execute the code to find whether you are getting same result as before or anything wrong. If incorrect result is produced then find the reason explain it to class friends.<\/p>\n<p><strong>2.2.3 : for( ; ; ) loop<\/strong><br \/>\nA for loop has all of its three parts i,e the iterator variable , loop-condition and logic to continue loop kept intact at one place separated by semi colon ( ; ) . This loop is also an Entry Control Loop, as condition is checked before entering into the scope of the loop. Let us analyze the syntax of a for looping:<br \/>\n<strong>Syntax:<\/strong><br \/>\nfor ( &lt;variable(s) initialization&gt; ; &lt;looping-condition&gt; ; &lt;incrementing \/ decrementing&gt; )<br \/>\n{<br \/>\n\/\/ do something<br \/>\n}<br \/>\nThe first part of a for loop is a place where all looping variables are declared and initialized in the same way we declare multiple variables of a single data type : e.g. int i = 0 , j = 2 , k = 9 &#8230; ;<br \/>\nThis part of the loop is executed only once at the start up of the loop and never it is executed again ( how can you re-declare variables with the same name! in same scope). As per turbo c++ compiler the scope of all these variables declared in for loop is same as program-scope i.e. they can be accessed from any other scope in the main( ), but the current ISO C++ has changed this making the scope of all these variable local to for loop only. You will follow the turbo c++ type scoping.<br \/>\nThe second part of a for loop defines the looping condition using set of relational and logical operators and governs the number of times the loop would execute. This looping condition is checked before entering into loop, for e.g. i &lt;= j+k etc.<br \/>\nThe third part of the for loop defines how to change the value of iterative \/ looping variables with each cycle. This is very important as to execute the loop for a fixed number of times , for e.g. i++ , j = j+k etc<br \/>\nLet us now integrate all the above three parts to observe how a for loop works :<br \/>\n<strong>Example :<\/strong><br \/>\nfor(int i = 0 ; i&lt;=3 ; i++)<br \/>\n{<br \/>\ncout&lt;&lt;\u201dArun Kumar\\n\u201d; cout&lt;&lt;\u201dKamal Kant Gupta\\n\u201d; cout&lt;&lt;\u201dAnil Kumar\\n\u201d;<br \/>\n}<br \/>\nThe above loop starts with declaring variable i = 0 , then it proceeds to the looping-condition part to check whether condition is satisfied (evaluates as true) so that the flow could enter into the scope of the loop. i.e. 0 &lt;= 3 which is true , the control flow is allowed to enter into the scope of the loop and all the statements ( the 3 lines ) gets executed one after another. After executing the last statement within the scope of for() the control proceeds to the third part of the loop where it increments the value of looping variable i by 1 , so that the variable is getting the next consecutive higher value i.e. i = 1. Hence the first Iteration of the for( ) loop is finished.<br \/>\nNow at the start of the next iteration the control flow directly proceeds to the second part of the for loop to evaluate looping-condition i.e. 1 &lt;= 3 which is true , the flow of control then proceeds in the similar way as it did in the first iteration and this is repeated till the looping-condition becomes false i.e. when i will become equal to 4 .<br \/>\nLet us put all the things discussed above in the form of an iteration tracking table :<br \/>\nIteration<br \/>\ni<br \/>\nLooping condition<br \/>\nOutput<br \/>\nStarting of loop<br \/>\n0<br \/>\n0&lt;=3 ^ true<br \/>\nArun Kumar Kamal Kant Gupta Anil Kumar<br \/>\nEnd of 1st Iteration<br \/>\ni++ ^ 1<br \/>\n1&lt;= 3 ^ true<br \/>\nSame as above<br \/>\nEnd of 2nd Iteration<br \/>\ni++ ^ 2<br \/>\n2&lt;= 3 ^ true<br \/>\nSame as above<br \/>\nEnd of 3 rd Iteration<br \/>\ni++ ^ 3<br \/>\n3&lt;=3 ^ true<br \/>\nSame as above<br \/>\nEnd of 4th Iteration<br \/>\ni++ ^ 4<br \/>\n4&lt;=3 ^ false<br \/>\nNo entry into for block , loop is terminated Observe the above table carefully to find that the loop has executed for 4 times, and the last value of the iterative variable on the termination of loop is 4.<br \/>\n<strong>Variations in for( ) loop :<\/strong><br \/>\nAll the three parts of a for loop are optional part i.e. they may or may not be present. Observe the valid variation in syntax of for( ) loop :<br \/>\n<strong>variation-1 :<\/strong><br \/>\nint i = 0;<br \/>\nfor( ; i&lt;=5 ; i++ ) cout&lt;&lt;\u201dHello to all\u201d;<br \/>\nIn the above for( ) loop the first part has been left i.e. we have not declared and initialized the iterator in for( ) , though it has been declared outside the scope of for( ).<br \/>\n<strong>variation-2 :<\/strong><br \/>\nint i = 0 ; for( ; ; i++)<br \/>\n{<br \/>\nif( i&lt;=5 )<br \/>\ncout&lt;&lt;\u201dHello to all\u201d; else break;<br \/>\n}<br \/>\nIn the above variation-2 the loop is not having first and second part defined for it, though the execution of the program remains same as version 1 since iterator has been declared and the condition for terminating the loop is implemented through a if-else construct inside the loop. You may observe that to terminate the loop we have used the break statement.<br \/>\nWhenever a break statement is found in a particular construct &#8216;s scope it immediately comes out of the current scope.<br \/>\n<strong>Variation-3 :<\/strong><br \/>\nint i = 0 ; for ( ; ; )<br \/>\n{<br \/>\nif( i&lt;=5 )<br \/>\n{<br \/>\ncout&lt;&lt;\u201dHello to all\u201d; i++;<br \/>\n}<br \/>\nelse<br \/>\nbreak;<br \/>\nThe above variation-3 is implemented in a similar to that of the variation-3 but it has its incrementation statement defined within if( ) construct.<br \/>\nIn all of the above variations you might have observed that it is compulsory to put a semicolon ( \ud83d\ude09 within for( ) even when statements before and after it are absent.<\/p>\n<p><strong>2.3 : Nested Loops<\/strong><br \/>\nStudents in section 2.1.7 we have seen that any conditional construct can be nested within any other conditional construct. Similarly any looping construct can also be nested within any other looping construct and conditional constructs.<br \/>\nLet us look at the following example showing the nesting of a for( ) loop within the scope of another for( ) loop :<br \/>\n<img decoding=\"async\" id=\"Picture 4\" src=\"https:\/\/media-mycbseguide.s3.amazonaws.com\/images\/static\/revise\/11\/computer\/ch4b\/image004.jpg\" \/><\/p>\n<p>For each iteration of the outer for loop the inner for loop will iterate fully up to the last value of inner loop iterator. The situation can be understood more clearly as :<br \/>\n1st Outer Iteration i= 1<br \/>\n1st Inner Iteration<br \/>\nj = 1 , output : 1 * 1 = 1 2nd Inner Iteration<br \/>\nj = 2 , output : 1 * 2 = 2 3rd Inner Iteration<br \/>\nj = 3 , output : 1 * 3 = 3<br \/>\n2nd Outer Iteration i= 2<br \/>\n1st Inner Iteration<br \/>\nj = 1 , output : 2 * 1 = 1 2nd Inner Iteration<br \/>\nj = 2 , output : 2 * 2 = 4 3rd Inner Iteration<br \/>\nj = 3 , output : 2 * 3 = 6<br \/>\nYou can observe that j is iterated from 1 to 2 every time i is iterated once.<br \/>\nWorkout Yourself :<\/p>\n<p>Write a program to print a multiplication table from 1 to 10 using concept of nested for loop<br \/>\nLet us summarize what we have learned till now :<br \/>\ni) There are two basic types of Conditional constructs : if() construct and switch-case statement. The if( ) has four different types of variations simple , compound , complex and nested.<br \/>\nii) There are three basic types of Iterative Constructs : while( ) , do-while( ) , and for( ) Out of these while( ) and for() have similar flow of execution whereas do-while() is bit different.<br \/>\niii) for( ) and while( ) are called as Entry Control Loop , whereas do-while( ) is called as exit-control loop.<br \/>\niv) Any of the Iterative construct could be nested within the scope of another iterative construct. A for( ) can be enclosed within scope of another for( ) , while( ) within a for() , a for( ) within a do-while( ) etc.<br \/>\nv) while programming for real life situation we are often going to mix conditional and iterative flow of logic as and when required.<\/p>\n<p><strong>Check your progress:<\/strong><br \/>\n1. Write C++ program to sum of following series:<br \/>\n., ^ \u201e 1 1 1 1 1<\/p>\n<p>i) S = 1 + \u2014 + \u2014 + \u2014 + \u2014 + \u2014 + &#8230; + nterms<br \/>\n2 3 4 5 6<br \/>\n111<\/p>\n<p>ii) S= 1 + -r + -r + -r+ .. + nterms<br \/>\n12 23 34<\/p>\n<p>iii) S = 1 &#8211; 2 + 3 &#8211; 5 + 6 &#8211; 7 + &#8230; n terms<br \/>\n1 2 2 33 nn<\/p>\n<p>iv) S = 1 + \u2014 + 7 r + 7 r +&#8230;-. r<br \/>\nx! (x -1) (x &#8211; 2) (x &#8211; n)<\/p>\n<p>2. Using while loop find the sum of digits of number if the inputted number is prime, if number is\u00a0then print the nearest prime number.<br \/>\nFor example: if user inputs number = 17 then the output would be = 1 + 7 = 8<br \/>\nif user inputs number = 20 then the output would be = 23 (next prime to 20)<\/p>\n<p>3. You might be knowing DNA in Biology , it is a genetic molecule made of four basic types of nucleotides. The four nucleotides are given one letter abbreviations as shorthand for the four bases.<br \/>\nA is for adenine G is for guanine C is for cytosine<br \/>\nT is for thymine<br \/>\nWhen considering the structure of DNA it is made of two strands. Each of these strands are made of long chains of above nucleotides like :<br \/>\nAAGCTCAGAGCTATG 1st strand<br \/>\nTTCGAGTCTCGATAC 2nd strand<br \/>\nEach of the nucleotide of 1st strand pairs with nucleotide in other strand using bond. These bonding obeys the following rule:<br \/>\nI) A will always pair with T and vice versa<br \/>\nII) G will always pair with C and vice versa<br \/>\nas it can be observed in the two strands given above.<br \/>\nWrite a program in C++ which allows user to input the nucleotide character sequence of 1st strand and print the probable sequence of the other strand. The user must provided opportunity to input a strand of any size, and only stops when user inputs an out of order character instead of A , G , C , &amp; T.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"_Using_C_constructs_class_11_Notes\"><\/span>\u00a0Using C++ constructs class 11 Notes<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>CBSE Revision notes (PDF Download) Free<\/li>\n<li>CBSE Revision notes for Class 11 Computer Science PDF<\/li>\n<li>CBSE Revision notes Class 11 Computer Science \u2013 CBSE<\/li>\n<li>CBSE Revisions notes and Key Points Class 11 Computer Science<\/li>\n<li>Summary of the NCERT books all chapters in Computer Science class 11<\/li>\n<li>Short notes for CBSE class 11th Computer Science<\/li>\n<li>Key notes and chapter summary of Computer Science class 11<\/li>\n<li>Quick revision notes for CBSE exams<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"CBSE_Class-11_Revision_Notes_and_Key_Points\"><\/span><strong>CBSE Class-11 Revision Notes and Key Points<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Using CPP constructs class 11 Notes Computer Science.CBSE quick revision note for class-11 Mathematics, Physics, Chemistry, Biology and other subject are very helpful to revise the whole syllabus during exam days. The revision notes covers all important formulas and concepts given in the chapter. Even if you wish to have an overview of a chapter, quick revision notes are here to do if for you. These notes will certainly save your time during stressful exam days.<\/p>\n<ul>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-physics\/1340\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Physics<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-chemistry\/1356\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Chemistry<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-mathematics\/1371\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Mathematics<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-biology\/1388\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Biology<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-accountancy\/1411\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Accountancy<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-economics\/1423\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Economics<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-business-studies\/1740\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Business Studies<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-computer-science\/1852\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Computer Science<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-informatics-practices\/1874\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Informatics Practices<\/a><\/li>\n<li><a href=\"http:\/\/mycbseguide.com\/downloads\/cbse-class-11-geography\/1864\/cbse-revision-notes\/7\/\">Revision Notes for class-11 Geography<\/a><\/li>\n<\/ul>\n<p>To download\u00a0 Using CPP constructs class 11 Notes, sample paper for class 11 Chemistry, Physics, Biology, History, Political Science, Economics, Geography, Computer Science, Home Science, Accountancy, Business Studies and Home Science; do check myCBSEguide app or website. myCBSEguide provides sample papers with solution, test papers for chapter-wise practice, NCERT solutions, NCERT Exemplar solutions, quick revision notes for ready reference, CBSE guess papers and CBSE important question papers. Sample Paper all are made available through\u00a0<a href=\"https:\/\/play.google.com\/store\/apps\/details?id=in.techchefs.MyCBSEGuide&amp;referrer=utm_source%3Dmycbse_bottom%26utm_medium%3Dtext%26utm_campaign%3Dmycbseads\"><strong>the best app for CBSE students<\/strong><\/a>\u00a0and myCBSEguide website.<\/p>\n<ul>\n<li class=\"entry-title\"><a href=\"https:\/\/mycbseguide.com\/blog\/computer-fundamentals-class-11-notes-computer-science\/\">Computer Fundamentals class 11 Notes Computer Science<\/a><\/li>\n<li class=\"entry-title\"><a href=\"https:\/\/mycbseguide.com\/blog\/introduction-to-cpp-class-11-notes-computer-science\/\">Introduction to CPP class 11 Notes Computer Science<\/a><\/li>\n<li class=\"entry-title\"><a href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\">Using CPP constructs class 11 Notes Computer Science<\/a><\/li>\n<li class=\"entry-title\"><a href=\"https:\/\/mycbseguide.com\/blog\/functions-cpp-class-11-notes-computer-science\/\">Functions in CPP class 11 Notes Computer Science<\/a><\/li>\n<li class=\"entry-title\"><a href=\"https:\/\/mycbseguide.com\/blog\/arrays-and-structures-class-11-notes-computer-science\/\">Arrays and Structures class 11 Notes Computer Science<\/a><\/li>\n<li class=\"entry-title\"><a href=\"https:\/\/mycbseguide.com\/blog\/programming-methodology-class-11-notes-computer-science-2\/\">Programming Methodology class 11 Notes Computer Science<\/a><\/li>\n<li><a href=\"https:\/\/mycbseguide.com\/blog\/programming-c-p-p-class-11-notes-computer-science\/\">Programming in C P P class 11 Notes Computer Science<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>CBSE Computer Science Chapter 5 Using CPP constructs class 11 Notes Computer Science in PDF are available for free download in myCBSEguide mobile app. The best app for CBSE students now provides \u00a0Using CPP constructs class 11 Notes Computer Science latest chapter wise notes for quick preparation of CBSE exams and school based annual examinations. &#8230; <a title=\"Using CPP constructs class 11 Notes Computer Science\" class=\"read-more\" href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\" aria-label=\"More on Using CPP constructs class 11 Notes Computer Science\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":10009,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,456],"tags":[457,150,326,426,240,803],"class_list":["post-10033","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cbse-class-11","category-revision-notes","tag-cbse-notes","tag-cbse-notes-and-key-points","tag-computer-science","tag-quick-revision","tag-quick-revision-notes","tag-using-cpp-constructs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using CPP constructs class 11 Notes Computer Science | myCBSEguide<\/title>\n<meta name=\"description\" content=\"Using CPP constructs class 11 Notes Computer Science Chapter 5 in PDF format for free download. Latest chapter wise notes for exams.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using CPP constructs class 11 Notes Computer Science | myCBSEguide\" \/>\n<meta property=\"og:description\" content=\"Using CPP constructs class 11 Notes Computer Science Chapter 5 in PDF format for free download. Latest chapter wise notes for exams.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\" \/>\n<meta property=\"og:site_name\" content=\"myCBSEguide\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/mycbseguide\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-02-15T06:42:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-17T09:47:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mycbseguide.com\/blog\/wp-content\/uploads\/2016\/09\/mycbseguide_n.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"599\" \/>\n\t<meta property=\"og:image:height\" content=\"242\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"myCBSEguide\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@mycbseguide\" \/>\n<meta name=\"twitter:site\" content=\"@mycbseguide\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"myCBSEguide\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"36 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\"},\"author\":{\"name\":\"myCBSEguide\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/#\/schema\/person\/f67796d5f5c5a468e8c680aaaad21519\"},\"headline\":\"Using CPP constructs class 11 Notes Computer Science\",\"datePublished\":\"2018-02-15T06:42:20+00:00\",\"dateModified\":\"2018-03-17T09:47:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\"},\"wordCount\":7188,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage\"},\"thumbnailUrl\":\"\",\"keywords\":[\"CBSE Notes\",\"CBSE Notes and Key Points\",\"Computer Science\",\"Quick Revision\",\"Quick Revision Notes\",\"Using CPP constructs\"],\"articleSection\":[\"Class 11\",\"Revision Notes\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\",\"url\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\",\"name\":\"Using CPP constructs class 11 Notes Computer Science | myCBSEguide\",\"isPartOf\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2018-02-15T06:42:20+00:00\",\"dateModified\":\"2018-03-17T09:47:51+00:00\",\"description\":\"Using CPP constructs class 11 Notes Computer Science Chapter 5 in PDF format for free download. Latest chapter wise notes for exams.\",\"breadcrumb\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\",\"width\":600,\"height\":300,\"caption\":\"Notes for Computer Fundamentals\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mycbseguide.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"CBSE\",\"item\":\"https:\/\/mycbseguide.com\/blog\/category\/cbse\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Class 11\",\"item\":\"https:\/\/mycbseguide.com\/blog\/category\/cbse\/cbse-class-11\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Using CPP constructs class 11 Notes Computer Science\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/#website\",\"url\":\"https:\/\/mycbseguide.com\/blog\/\",\"name\":\"myCBSEguide\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mycbseguide.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/#organization\",\"name\":\"myCBSEguide\",\"url\":\"https:\/\/mycbseguide.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/mycbseguide.com\/blog\/wp-content\/uploads\/2016\/04\/books_square.png\",\"contentUrl\":\"https:\/\/mycbseguide.com\/blog\/wp-content\/uploads\/2016\/04\/books_square.png\",\"width\":180,\"height\":180,\"caption\":\"myCBSEguide\"},\"image\":{\"@id\":\"https:\/\/mycbseguide.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/mycbseguide\/\",\"https:\/\/x.com\/mycbseguide\",\"https:\/\/www.linkedin.com\/company\/mycbseguide\/\",\"http:\/\/in.pinterest.com\/mycbseguide\/\",\"https:\/\/www.youtube.com\/channel\/UCxuqSnnygFzwJG0pwogCNEQ\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/mycbseguide.com\/blog\/#\/schema\/person\/f67796d5f5c5a468e8c680aaaad21519\",\"name\":\"myCBSEguide\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using CPP constructs class 11 Notes Computer Science | myCBSEguide","description":"Using CPP constructs class 11 Notes Computer Science Chapter 5 in PDF format for free download. Latest chapter wise notes for exams.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/","og_locale":"en_US","og_type":"article","og_title":"Using CPP constructs class 11 Notes Computer Science | myCBSEguide","og_description":"Using CPP constructs class 11 Notes Computer Science Chapter 5 in PDF format for free download. Latest chapter wise notes for exams.","og_url":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/","og_site_name":"myCBSEguide","article_publisher":"https:\/\/www.facebook.com\/mycbseguide\/","article_published_time":"2018-02-15T06:42:20+00:00","article_modified_time":"2018-03-17T09:47:51+00:00","og_image":[{"width":599,"height":242,"url":"https:\/\/mycbseguide.com\/blog\/wp-content\/uploads\/2016\/09\/mycbseguide_n.jpg","type":"image\/jpeg"}],"author":"myCBSEguide","twitter_card":"summary_large_image","twitter_creator":"@mycbseguide","twitter_site":"@mycbseguide","twitter_misc":{"Written by":"myCBSEguide","Est. reading time":"36 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#article","isPartOf":{"@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/"},"author":{"name":"myCBSEguide","@id":"https:\/\/mycbseguide.com\/blog\/#\/schema\/person\/f67796d5f5c5a468e8c680aaaad21519"},"headline":"Using CPP constructs class 11 Notes Computer Science","datePublished":"2018-02-15T06:42:20+00:00","dateModified":"2018-03-17T09:47:51+00:00","mainEntityOfPage":{"@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/"},"wordCount":7188,"commentCount":0,"publisher":{"@id":"https:\/\/mycbseguide.com\/blog\/#organization"},"image":{"@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage"},"thumbnailUrl":"","keywords":["CBSE Notes","CBSE Notes and Key Points","Computer Science","Quick Revision","Quick Revision Notes","Using CPP constructs"],"articleSection":["Class 11","Revision Notes"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/","url":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/","name":"Using CPP constructs class 11 Notes Computer Science | myCBSEguide","isPartOf":{"@id":"https:\/\/mycbseguide.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage"},"image":{"@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage"},"thumbnailUrl":"","datePublished":"2018-02-15T06:42:20+00:00","dateModified":"2018-03-17T09:47:51+00:00","description":"Using CPP constructs class 11 Notes Computer Science Chapter 5 in PDF format for free download. Latest chapter wise notes for exams.","breadcrumb":{"@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#primaryimage","url":"","contentUrl":"","width":600,"height":300,"caption":"Notes for Computer Fundamentals"},{"@type":"BreadcrumbList","@id":"https:\/\/mycbseguide.com\/blog\/using-c-constructs-class-11-notes-computer-science\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mycbseguide.com\/blog\/"},{"@type":"ListItem","position":2,"name":"CBSE","item":"https:\/\/mycbseguide.com\/blog\/category\/cbse\/"},{"@type":"ListItem","position":3,"name":"Class 11","item":"https:\/\/mycbseguide.com\/blog\/category\/cbse\/cbse-class-11\/"},{"@type":"ListItem","position":4,"name":"Using CPP constructs class 11 Notes Computer Science"}]},{"@type":"WebSite","@id":"https:\/\/mycbseguide.com\/blog\/#website","url":"https:\/\/mycbseguide.com\/blog\/","name":"myCBSEguide","description":"","publisher":{"@id":"https:\/\/mycbseguide.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mycbseguide.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/mycbseguide.com\/blog\/#organization","name":"myCBSEguide","url":"https:\/\/mycbseguide.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mycbseguide.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/mycbseguide.com\/blog\/wp-content\/uploads\/2016\/04\/books_square.png","contentUrl":"https:\/\/mycbseguide.com\/blog\/wp-content\/uploads\/2016\/04\/books_square.png","width":180,"height":180,"caption":"myCBSEguide"},"image":{"@id":"https:\/\/mycbseguide.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/mycbseguide\/","https:\/\/x.com\/mycbseguide","https:\/\/www.linkedin.com\/company\/mycbseguide\/","http:\/\/in.pinterest.com\/mycbseguide\/","https:\/\/www.youtube.com\/channel\/UCxuqSnnygFzwJG0pwogCNEQ"]},{"@type":"Person","@id":"https:\/\/mycbseguide.com\/blog\/#\/schema\/person\/f67796d5f5c5a468e8c680aaaad21519","name":"myCBSEguide"}]}},"_links":{"self":[{"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/posts\/10033","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/comments?post=10033"}],"version-history":[{"count":4,"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/posts\/10033\/revisions"}],"predecessor-version":[{"id":11786,"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/posts\/10033\/revisions\/11786"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/media\/10009"}],"wp:attachment":[{"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/media?parent=10033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/categories?post=10033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mycbseguide.com\/blog\/wp-json\/wp\/v2\/tags?post=10033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}