Section 7: Simple Programming122
common practice, and one that makes a flowchart extremely useful in visualizing a complete program.
Flowcharts are drawn linearly, from top to bottom. This represents the general flow of the program from beginning to end. Although flowcharting symbols sometimes vary, throughout this handbook we have held to the convention of circles for the beginning and end of a program or routine, and rectangles to represent the functional operations in a program. We use diamonds to represent decisions, where the program must decide which of two alternatives to take.
For example, if you had two numbers and wished to write a program that would display only the larger, you might design your program by first drawing a flowchart that looked like this:
         
Start
         
                       
         
Input #1
         
                       
         
Input #2
         
                       
     
Yes
Yes
Yes
Yes
Is
#1 larger
than #2
?
No
No
No
No
     
           
                     
 
Display #1
         
Display #2
 
                         
 
Stop
         
Stop
 
It would be a simple matter to go back and insert groups of instructions for each element of the flowchart. As you work through this handbook, you will become more familiar with flowcharts. Flowcharts will help you to organize, eliminate errors in logic and flow, and document your programs.