Repeatative Structures in C++ programming
Repeatative Structures:
Loops are uses to repeat values. The two types of loops are as follow:
i. for Loop
ii. while Loop
* for Loop:
It has three points i.e.;
i. Starting point
ii. Ending point
iii. Counter
Syntax:
for(starting point; ending point; counter)
{
(statement)
}
for(int i=0; i<5 br="" i=""> {
(statement)
}
in the above syntax we first declares an integer type variable and gives that the
starting point i.e.; 0 and then gives that the ending point i.e.; less than 5
This means that the loop will start from 0 and stops after five turns.
At the last there are double + with that variable use for next turn. This is called the counter.
5>
Comments
Post a Comment