Previous page Next page Navigation bar

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:

  1. A decision diamond, with two alternative branches 2 and 3.
  2. A process box, being one of the alternatives of the decision diamond 1.
  3. A decision diamond, being the other alternative of the decision diamond 1, with two alternative branches 4 and 5.
  4. A process box, being one of the alternatives of the decision diamond 3.
  5. A decision diamond, being the other alternative of the decision diamond 3, with two alternative branches 6 and 7.
  6. A process box, being one of the alternatives of the decision diamond 5.
  7. A process box, being the other alternative of the decision diamond 5.
  8. A set of arrows combining flows from process boxes 6 and 7.
  9. A set of arrows combining flows from the process box 4 and the arrows 8.
  10. 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:

  1. A decision diamond, with two alternative branches 2 and 4.
  2. A decision diamond, being one of the alternatives of the decision diamond 1, with two alternative branches 3 and 5.
  3. 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.
  4. A process box, being the other of the alternatives of the decision diamond 1.
  5. 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:

  1. A decision diamond, with two alternative branches 2 and 8.
  2. 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.
  3. A decision diamond, with two alternative branches 4 and 5.
  4. A process box, being one of the alternatives of the decision diamond 3.
  5. A process box, being the other of the alternatives of the decision diamond 4.
  6. A set of arrows combining flows from process boxes 4 and 5, and going to process box 7.
  7. A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
  8. 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:

  1. A decision diamond, with two alternative branches 2 and 8.
  2. 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.
  3. A decision diamond, with two alternative branches 4 and 5.
  4. A process box, being one of the alternatives of the decision diamond 3.
  5. A process box, being the other of the alternatives of the decision diamond 4.
  6. A set of arrows combining flows from process boxes 4 and 5, and going to process box 7.
  7. A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
  8. 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:

  1. A decision diamond, with two alternative branches 2 and 5.
  2. 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.
  3. A process box, with an arrow showing the process box 4 as the successor in the flow.
  4. A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
  5. 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:

  1. A decision diamond, with two alternative branches 2 and 3.
  2. 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.
  3. 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:

  1. 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:

  1. 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:

  1. A decision diamond, with two alternative branches 2 and 3.
  2. 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.
  3. 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:

  1. A decision diamond, with two alternative branches 2 and 5.
  2. 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.
  3. A process box, with an arrow showing the process box 4 as the successor in the flow.
  4. A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
  5. 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:

  1. A decision diamond, with two alternative branches 2 and 8.
  2. 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.
  3. A decision diamond, with two alternative branches 4 and 5.
  4. A process box, being one of the alternatives of the decision diamond 3.
  5. A process box, being the other of the alternatives of the decision diamond 4.
  6. A set of arrows combining flows from process boxes 4 and 5, and going to process box 7.
  7. A process box, with an arrow showing the decision diamond 1 as the successor in the flow.
  8. 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:

  1. A decision diamond, with two alternative branches 2 and 9.
  2. 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.
  3. A decision diamond, with two alternative branches 4 and 6.
  4. A decision diamond, being one of the alternatives of the decision diamond 3, with two alternative branches 5 and 7.
  5. 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.
  6. A process block, being the other of the alternatives of the decision diamond 3.
  7. 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.
  8. A process block, with an arrow showing the decision diamond 1 as the successor in the flow.
  9. 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 ]

Previous page Top of page Next page Navigation bar

Copyright © 2002 Brian Hetrick
Page last updated 13 January 2002.

Brian’s Casio Calculator Corner

Home

Programs

Tutorial

Preface

Introduction

Fundamentals

Building Blocks I

Introduction

Comments

Data Types

Numbers

Variables

Expressions

Control Flow I

Introduction

Sequences

Alternatives

Loops

Composition

Control Flow II

Subprograms

Basic I/O

Algorithms

A First Program

Examples

Exercises

Answers

Modularization

Data Structures I

Recursion

Program Attributes

Building Blocks II

Algorithm Analysis

Structuring

Data Structures II

Abstract Types

Objects

Problem Analysis

Reference Card

References

Puzzles

Site Information

Your Privacy

Site Map

E-mail

Site Technical Data