PRINCIPAL STRUCTURES IN FLOW CHARTING
Structured programing calls for the usage of four principal structures to help simplify the program. They are:
- Sequential control
- IF-THEN-ELSE control
- Replication PRE-TEST (DO WHILE) AND POST-TEST (DO UNTIL)
- Case Structure PRE-TEST AND POST-TEST
These structures are illustrated in the 5 figures.
The first of the figures, is the conventional sequential flow in a given order. That is, Module A, followed by Module B and followed by Module C. For example: Data is read, data is processed and data is printed out.
The second structure, is used for processing if a specific condition is true. For example: If the condition is true, then MODULE A is processed, ELSE the condition is false and MODULE B is processed.
The third structure is used for repeated operations (replications). For example: Do the following sequence of instructions WHILE the condition is TRUE.
The DO AND TEST (or DO UNTIL) is similar to the DO WHILE except for an important difference. In the DO WHILE the condition for executing MODULE A is first checked and if not true, MODULE A is not executed. In the DO AND TEST, MODULE A is first processed, then the condition tested.
The following figure describes the case structure. This is applicable when there are multiple alternatives available and depending on the testing of a condition, exactly one case has to be processed.
Any program can be designed by combining these various structures.