In the Control Flow Alternatives page, a flowchart describes the algorithm under discussion. The algorithm in text form is as follows:
In the Control Flow Alternatives page, a flowchart fragment demonstrates the structure of the alternative construct. The construct consists of three flowchart symbols: a diamond, representing a decision; and two rectangles, representing processing.
The diamond is on the centerline of the diagram, with the two rectangles lower than the diamond, arranged symmetrically around the centerline. A short arrow leads into the top of the diamond. The diamond contains the text “condition.” An arrow goes out from either side vertex of the diamond; one arrow has the label “true,” the other the label “false.” Each arrow goes horizontally away from the diamond for a short distance, then goes down to the rectangle under it.
The rectangle reached through the arrow with the label “true” contains the text “Alternative for condition true.” The rectangle reached through the arrow with the label “false” contains the text “Alternative for condition false.”
Each of the processing rectangles has an arrow coming from the bottom of the rectangle. The arrows go down away from the rectangle for a short distance, then turns and heads to the centerline of the diagram. The arrows meet at the centerline of the diagram, where a third short arrow goes down.
In the Control Flow Alternatives page, a flowchart fragment gives an example of a set of alternative constructs that compute the smaller positive root of a quadratic equation guaranteed to have at least one positive root. The algorithm fragment is as follows:
Click here to return to the alternatives page.
Copyright © 2001 Brian Hetrick
Page last updated 30 December 2001.
Building Blocks I
Control Flow I
Control Flow II
A First Program
Data Structures I
Building Blocks II
Data Structures II