Coupon Accepted Successfully!


Statement Flow Control

  • When a program is executed, the CPU starts execution at the main function, executes the given number of statements and terminates the main function.
  • The sequence of statement executed is called as a path of the program.
  • In C++ this path is called as statement flow control.
  • In this the programmer is allowed to change the CPU's path through the program.
  • There are three types of statement flow control statements.
  • They are
    • Sequence statement
    • Iteration statement
    • Selection statement

Sequence Statement

  • A program is a sequence of instruction.
  • It is a straight forward control, where the programming statements are executed in the order that they are written from top to bottom in an order.
  • Every program executes the first statement main() and further continuous the statement of the program.
  • The following figure explains the sequence statement.

Note: main () function is called as driver function as it drives the program.

Selection Statement

  • These statements are executed depending on the condition provided.
  • It performs two operations.
  • One if the conditions are true and the other if the condition is false.
  • This statement is other wise called as decision making statement.
  • The following figure explains the selection statement in detail
Note: In c++ zero (0) is considered to be false statement and other non zero values are considered to be a true statement.

Test Your Skills Now!
Take a Quiz now
Reviewer Name