C++ Concept Map

Structured Programming

Structured programming began as a solution to the kind of "spaghetti code" produced by trhe use of poor programming techniques with the goto statement. Dijkstra developed the idea of structuring the control flow of a program so that modularity could be employed to iad the programmer. The dreaded goto statement was no longer needed. In his method, there are only three main constructs, each best depicted  by a flow chart. Each rectangle can hold a simple statement (assignment or function call) or any structured construct, i.e. any of the three diagrams. Each diagram has only one entry point and one exit, giving exactly the required modularity.

1. The sequence, i.e. a sequence of at least two statements. The ability to replace any statement by any other structured construct means that any number of statements can be put in sequence.

2. The selection, or conditional. The result of the test in the diamond box leads to one or other statement, but at the conclusion of either one, control flows to a single point.

3. The loop. The test will make the loop finish if it is false, otherwise the loop in the diagram takes control back to the test after the statement in the body of the loop is executed.

These three are sufficient to express any algorithm.


Please mail any corrections and/or suggestions to Roger Hartley at
rth@cs.nmsu.edu

Copyright © 2000 Roger Hartley