Calculator Programming Tutorial
Programming Building Blocks I
Control Flow I
Structure Composition Flowchart Descriptions
In the Structure Composition page,
a number of flowcharts are used to illustrate the embedding of one
structure in another.
This page describes these flowcharts.
Nested Alternatives Flowchart
The first flowchart illustrates nesting of alternatives in one
another.
This flowchart illustrates the structure of the first flowchart
in the Alternatives page.
The overall structure of this flowchart is as follows:
-
A decision diamond, with two alternative branches 2 and 3.
-
A process box, being one of the alternatives of the decision diamond 1.
-
A decision diamond, being the other alternative of the decision diamond 1, with two alternative branches 4 and 5.
-
A process box, being one of the alternatives of the decision diamond 3.
-
A decision diamond, being the other alternative of the decision diamond 3, with two alternative branches 6 and 7.
-
A process box, being one of the alternatives of the decision diamond 5.
-
A process box, being the other alternative of the decision diamond 5.
-
A set of arrows combining flows from process boxes 6 and 7.
-
A set of arrows combining flows from the process box 4 and the arrows 8.
-
A set of arrows combining flows from the process box 2 and the arrows 9.
Loop Inside Alternative Flowchart
The second flowchart illustrates nesting of a loop inside an alternative. The overall structure of this flowchart is as follows:
-
A decision diamond, with two alternative branches 2 and 4.
-
A decision diamond, being one of the alternatives of the decision diamond 1, with two alternative branches 3 and 5.
-
A process box, being one of the alternatives of the decision diamond 2, with an arrow showing the decision diamond 2 as next in the flow.
-
A process box, being the other of the alternatives of the decision diamond 1.
-
A set of arrows combining flows from the decision diamond 2 and the process box 4.
Sequence and Alternative Inside Loop Flowchart
The third flowchart illustrates a sequence and an alternative inside a loop. The overall structure of this flowchart is as follows:
-
A decision diamond, with two alternative branches 2 and 8.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the decision diamond 3 as the successor in the flow.
-
A decision diamond, with two alternative branches 4 and 5.
-
A process box, being one of the alternatives of the decision diamond 3.
-
A process box, being the other of the alternatives of the decision diamond 4.
-
A set of arrows combining flows from process boxes 4 and 5, and going to process box 7.
-
A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
Flowcharts Simplifying
The fourth illustration shows a sequence of flowcharts, with single entrance/single exit constructs in each flowchart being replaced by a process box in the subsequent flowchart. The first flowchart has the structure:
-
A decision diamond, with two alternative branches 2 and 8.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the decision diamond 3 as the successor in the flow.
-
A decision diamond, with two alternative branches 4 and 5.
-
A process box, being one of the alternatives of the decision diamond 3.
-
A process box, being the other of the alternatives of the decision diamond 4.
-
A set of arrows combining flows from process boxes 4 and 5, and going to process box 7.
-
A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
The decision diamond 3, process boxes 4 and 5, and control flow joining
arrows 6 are all replaced by a single process box, resulting in the structure:
-
A decision diamond, with two alternative branches 2 and 5.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the process box 3 as the successor in the flow.
-
A process box, with an arrow showing the process box 4 as the successor in the flow.
-
A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
The three process boxes 2, 3, and 4 are all replaced by a single process box, resulting in the structure:
-
A decision diamond, with two alternative branches 2 and 3.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
The decision diamond 1 and process box 2 are replaced by a single process box, resulting in the structure:
-
A process box, with an arrow showing the successor is to exit the flowchart.
Flowcharts Showing Refinement
The fifth illustration shows a sequence of flowcharts, with process boxes in each flowchart being replaced by single entrance/single exit constructs in the subsequent flowchart. The first flowchart has the structure:
-
A process box, with an arrow showing the successor is to exit the flowchart.
The process box 1 is replaced with a loop construct, resulting in the structure:
-
A decision diamond, with two alternative branches 2 and 3.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
The process box 2 is replaced with three successive process blocks, resulting in the structure:
-
A decision diamond, with two alternative branches 2 and 5.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the process box 3 as the successor in the flow.
-
A process box, with an arrow showing the process box 4 as the successor in the flow.
-
A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
The process block 3 is replaced with an alternative construct, resulting in the structure:
-
A decision diamond, with two alternative branches 2 and 8.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the decision diamond 3 as the successor in the flow.
-
A decision diamond, with two alternative branches 4 and 5.
-
A process box, being one of the alternatives of the decision diamond 3.
-
A process box, being the other of the alternatives of the decision diamond 4.
-
A set of arrows combining flows from process boxes 4 and 5, and going to process box 7.
-
A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
The process block 4 is replaced with a loop construct, resulting in the structure:
-
A decision diamond, with two alternative branches 2 and 9.
-
A process box, being one of the alternatives of the decision diamond 1, with an arrow showing the decision diamond 3 as the successor in the flow.
-
A decision diamond, with two alternative branches 4 and 6.
-
A decision diamond, being one of the alternatives of the decision diamond 3, with two alternative branches 5 and 7.
-
A process block, being one of the alternatives of the decision diamond 4, with an arrow showing the decision diamond 4 as the successor in the flow.
-
A process block, being the other of the alternatives of the decision diamond 3.
-
A set of arrows joining flows from the second alternative of decision diamond 4 and the process block 6, and showing the process block 8 as the successor in the flow.
-
A process block, with an arrow showing the decision diamond 1 as the successor in the flow.
-
An arrow showing the other alternative of the decision diamond 1 being to exit the flowchart.
Click here to return to the Structure
Composition page.
[ Previous page | Top of page
| Next page ]
Copyright © 2002 Brian Hetrick
Page last updated 13 January 2002.