What is Sequence Structure in C++

- February 12, 2018
In a sequence structure or sequential structure, the statements of a program are executed in the same order in which they are written in the program. The statements are executed one after the other. In this structure, all statements of the program executed sequentially without skipping any statement. 
An algorithm with sequence structure are as follows:
Diagram of sequence structure

In the above diagram, the first statement is "Statement-1" and "Statement-n" is the last statement that will be executed in a sequence from top to bottom (such as from statement-1 to statement-n).

Example Program of C++ Sequence Structure:

The following source code of the program execute statement one by other and displays result on the screen. 

#include<iostream.h>
#include<canio.h>
main()
{
  cout << "First statement\n";
  cout << "Second statement\n";
  cout << "Third statement\n";
  cout << "Forth statement\n";
  getch();
}//end main function
If you run this program, the output will be as follows:
First statement
Second statement
Third statement
Forth statement