PATH: Instructional Server> COP 2000> Examples> if/else Selection>

Outlined Algorithm for an if/else Selection Structure


This web page contains a text-based alternative to a flowcharting diagram showing an if/else Selection Structure as described in the web page entitled Selection Using the if Statement in a C Program.

It is important to clearly describe logical control structures that involve branching away from the simple sequential flow of steps and the conditions upon which they are based. Outlines are well suited to this task because of the hierarchical nature of their lettered and numbered steps. Analysts often employ indentation using tabs or spaces to help clarify step subordination. If your rendering software cannot indicate the presence of such "whitespace" characters, be give careful attention to the labeling of the steps to determine the subordination of the steps.

Note: in the document below, "[CR]" represents the carriage return and/or line feed sequence necessary to start a new line of output. The document is not a complete algorithm; just a segment of one, starting for example with step C.

C. Test the condition: A greater than 0 and less than 9.
   C.1. If true, assign X as X times 3.
   C.2. Otherwise:
        C.2.a. Assign X as 1.
        C.2.b. Assign A as 0.
PATH: Instructional Server> COP 2000> Examples> if/else Selection>