Tutorial 10



Control statements in C++ 
If statement, this statement helps in decision and is used with relational operators. If the condition is true then the specified set of statement provided in the true section is executed else the set of instructions in true block is skipped and rest of the instructions are executed. If else statement, this is also decision based statement, when condition is true then the set of instructions in if is executed else the set of instruction in else section is executed. FOR loop statement helps in executing set of instructions number of times. Syntax of for loop is for (condition;resume condition;re-valuation) followed  by set of instructions to be executed number of times. While loop statement is used to execute the set of instructions number of times or till the time the condition is met. Next one is do-while loop statement which has the only difference with while statement that the set of statement gets executed at least once, then at the end of the set of instructions condition is validated and set of instructions are executed number of times the condition is true. exit() and break functions. exit() function is used whenever we want to exit the program at some point before the completion of execution of all the instructions in a program. Whereas break only exits the current loop. continue function is provided just opposite to the break function that forces the system to continue execute the set of instructions in a loop.