Control statements are statements that alter the sequence of flow of instructions.
In a program, statements may be executed sequentially, selectively or iteratively. Every programming languages provides statements to support sequence, selection (branching) and iteration.
If the Statements are executed sequentially, the flow is called as sequential flow. In some situations, if the statements alter the flow of execution like branching, iteration, jumping and function calls, this flow is called as control flow.
The sequential statement are the statements, that are executed one after another only once from top to bottom. These statements do not alter the flow of execution. These statements are called as sequential flow statements. They are always end with a semicolon (;).
The selection statement means the statement (s) are executed depends upon a condition. If a condition is true, a true block (a set of statements) is executed otherwise a false block is executed. This statement is also called decision statement or selection statement because it helps in making decision about which set of statements are to be executed.
The iteration statement is a set of statement are repetitively executed depends upon a conditions. If a condition evaluates to true, the set of statements (true block) is executed again and again. As soon as the condition becomes false, the repetition stops. This is also known as looping statement or iteration statement.
The set of statements that are executed again and again is called the body of the loop. The condition on which the execution or exit from the loop is called exit-condition or test-condition.
Generally, all the programming languages supports this type of statements to write programs depends upon the problems. C++ also supports this type of statements. These statements will be discussed in coming sections.
In selection statements and iteration statements are executed depends upon the conditional expression. The conditional expression evaluates either true or false.