8 Programming and Data Structures
1.6 FLOWCHARTS
A flowchart is a visual representation of the sequence of steps for solving a problem. It enlightens
what comes first, second, third, and so on. A completed flowchart enables you to organize your
problem into a plan of actions. Even for designing a product a designer many times has to draw a
flowchart. It is a working map of the final product. This is an easy way to solve the complex designing
problems. The reader follows the process quickly from the flowchart instead of going through the
text.
A flowchart is an alternative technique for solving a problem. Instead of descriptive steps, we use
pictorial representation for every step. It shows a sequence of operations. A flowchart is a set of
symbols, which indicates various operations in the program. For every process, there is a
corresponding symbol in the flowchart. Once an algorithm is written, its pictorial representation
can be done using flowchart symbols. In other words, a pictorial representation of a textual algorithm
is done using a flowchart.
We give below some commonly used symbols in flowcharts.
Start and end: The start and end symbols indicate both the beginning and the end of the flowchart.
This symbol looks like a flat oval or is egg shaped. Fig. 1.5 shows the symbol of Start/stop.
Only one flow line is combined with this kind of symbol. We write START, STOP or END in the
symbols of this kind. Usually this symbol is used twice in a flowchart, that is, at the beginning and
at the end.
^ Start ^
( St°p )
Fig. 1.5 Start/stop symbol
Decision or test symbol: The decision symbol is diamond shaped. This symbol is used to take one
of the decisions. Depending on the condition the decision block selects one of the alternatives. While
solving a problem, one can take a single, two or multiple alternatives depending upon the situation.
All these alternatives are illustrated in this section. A decision symbol with a single alternative is
shown in Fig. 1.5. In case the condition is satisfied /TRUE a set of statement(s) will be executed
otherwise for false the control transfers to exit.
Single alternative decision: Here more than one flow line can be used depending upon the condition.
It is usually in the form of a 'yes' or 'no' question, with branching flow lines depending upon the
answer. With a single alternative, the flow diagram will be as per Fig. 1.6.