"Statements used to control the flow of execution in a program".
- Means a statement through which we control the behavior of our program like what kind of
- function it will perform, when it will terminate or continue under certain circumstances or conditions.
- These instructions enable us to group individual instructions into a single logical unit with one entry point and one exit point. To make it more clearer, suppose we have lot of statements in our program by using control structure we control their working like either all statements will evaluate at once on the basis of certain condition or will evaluate one by one or will not be evaluated.
All programs use control structures to implement the program logic.
There are three types of Control Structures
3. Loops/ Repetition/ Iteration
Sequence structure in C++:
As name refers instructions are executed in the sequence in which they are written in the program.
Example: Compound Statement:
Statements - 1
Statements - 2
- - - - - - - - -
Selection structure in C++:
A structure which select which statement or block of statements will execute on the basis of our
1. if - else statement
Loops in C++:
These structures are used to repeat the statement or set of statements.
1. for - loop
2. while - loop
3. do - while loop