Upload
profmanikandan
View
12
Download
0
Tags:
Embed Size (px)
DESCRIPTION
C++ Control Statement Notes
Citation preview
CONTROL STATEMENT
CONTROL STRUCTURES & POINTERS IN C++ By Prof. ManikandanDept of Computer [email protected] Statements
1.Conditional ExecutionThe conditional expressions are mainly used for decision making. The following statements are used to perform the task of the conditional operations.
1. if statement2. if-else statement3. Nested If statement
LoopingA set of statements are to be executed continuously until certain condition is satisfied.
There are various loop statements available in C++.1. for loop2. while loop3. do-while loop
For loopThis loop consists of three expressions. The first expression is used to initialize the index value. The second to check whether or not the loop is to be continued again. The third to change ++ or -- the index value for further iteration.
Syntaxfor (initial_condition; test_condition; inc or dec value){statement_1;statement_2;;;;;}
Example Program:
#include#includevoid main(){int i;clrscr();for(i=0; i