2. Flow of control
Statement
Selection /decision
Iteration/loop
Jump statements
2
3. The flow of control jumps from one part of
the program to another, depending on
calculations performed in the program
Program statements that cause such jumps
are called control statements. There are
two major categories: loops and decisions
3
5. Statements are the instructions given to
the computer to perform any kind of
action , be it data movements, be it
making decisions or be it repeating actions.
Statements are the smallest executing unit
of a C++ program.
5
6. A compound statement in C++ is a sequence
of statements enclosed by a pair of
branches { }.
{
statements 1 ;
statements 2 ;
: }
represents a compound statement
6
7. The selection construct means the execution
of statements depending upon a condition
evaluates true, a set of statements is
followed.
7
9. Also known as either or. This statement is
used to select one statement and ignore the
other statements.
if(condition)
s1;
else
s2;
when the condition is true statement
s1 is executed. If the condition is false s2 is
executed. Thus one of the statements, either s1
or s2 is always executed
9
10. It is a multi branch statement which can be used
to select and execute one of the available
statements.
switch(value)
{
case 1: statement 1;
break;
case 2: statement 2;
break;
case n: statement n;
break;
default: statement d;
}
10
11. Loops cause a section of your program to be
repeated a certain number of times.
When the condition becomes false, the loop
ends and control passes to the statements
following the loop
11
12. for
Natural "counting" loop
do-while
Least flexible Always executes loop body
at least on
while
Most flexible No “restrictions
12
13. It is a repeated structure which can repeat a
statement as long as the given condition is
satisfied.
for(statement1; condition; statement2)
statement3;
13