In sequential structure, basic I/O program statements are executed one after another, in the order by which they appear in the program. Here is a sample diagram on how linear is the sequential structure is:
The flow of sequential structure diagram shows that the basic flow has its pattern of, first, initialization of variables, followed by the input of data then processing the inputs and all the variables needed (through computation and usage of operators and displaying the final output.
#include <iostream>
using namespace std;
int main() {
//initialization
int num1, num2, prod;
//input
cout << "Enter the first number: ";
cin >> num1;
cout << "Enter the second number: ";
cin >> num2;
//process
prod = num1 * num2;
//output
cout << "Product: " << prod;
return 0;
}
Sample Output:
Enter the first number: 5
Enter the second number: 5
Product: 25
Check for the first part of this video for further explanation about sequential control structure: