Control Structures
Sequence
Selection
Iteration
A structured program is defined by D'Orzio (1990) as:
A computer program which is implemented using only those
control structures which are found in structured program
designs.
What makes a program design structured? In 1964, Bohm and Jacopini published a paper
which demonstrated that any problem can be solved by using the three logic control
structures of sequence, selection and iteration (or repetition). The three structured
programming constructs are illustrated in flowchart and statement form below.
Sequence
The sequence control structure consists of processes which are carried out in a sequential
manner:
STATEMENT A
STATEMENT B
STATEMENT C
Our Do Payroll algorithm is an example of a simple sequential control structure.
Selection
The selection control structure consists of a condition which is either True or False.
Processes will be carried out depending on the result of the condition test.
In pseudocode, selection is represented by the IF, THEN, ELSE, and ENDIF statements.
IF Condition is true THEN
DO Process A
ELSE
DO Process B
ENDIF
Using our Morning Routine algorithm, we can apply the selection control structure to the
Take a Shower task.
Click here to see another example of this control structure.
Iteration
The iteration control structure consists of actions that need to be repeated over and over again
while a particular condition is true. This is the concept of the LOOP.
In pseudocode, iteration is represented by the WHILE and ENDWHILE statements.
WHILE Condition is true DO
Process statements
ENDWHILE
We can apply the iteration control structure to the major tasks of our Do Payroll algorithm.
To see examples of common variations on the selection control structure, select More
Selection on the menu tree.
To see examples of common variations on the iteration control structure, select More
Iteration on the menu tree.
Programming Constructs Activity
Activity One Activity Two