ACSC 104 - Computer Programming For Engineers: Lecture 2: Flowcharts
ACSC 104 - Computer Programming For Engineers: Lecture 2: Flowcharts
Lecture 2: Flowcharts
A flowchart is a pictorial description of an algorithm. The flowchart outlines the
structure
and logic of the algorithm and the sequence of operations to be followed in solving
the problem. A flowchart is composed of a set of standard symbols, each of which is
unique in shape and represents a particular type of operation (see Figure 2.1). The
symbols are connected by straight lines called flowlines. These usually contain arrows
to indicate the order in which the operations are performed. A flowchart provides a
means of organizing our thinking about a problem solution. Because flowcharts
provide pictorial representations of the steps that are to be followed, they assist in both
the development and communication of the logic of the problem solution. They are
also helpful in detecting and correcting errors in logic and developing more efficient
structures.
A flowchart is useful for complicated programs which contain numerous branches,
since it can depict the interrelationships between the various branches and loops.
Flowcharts also allow us to quickly test several alternative solutions to a problem since
it is much easier to draw the flowchart than to write the program. Once a flowchart
has been developed, the task of writing the program is greatly simplified.
Finally, a flowchart is an excellent vehicle for documenting a program. It provides a
convenient means of communication between both programmers and
nonprogrammers. This is important during the development of a program, especially
when several people are working on the same project. Since a flowchart is not
dependent on a particular programming language, it can be understood by another
programmer and by people who have limited knowledge of programming. This can be
of great benefit during later maintenance and use of the program.
In summary, a flowchart is an analytical tool and is useful for documentation and as
a
communication device.
Flowchart
Symbols
The symbols used in flowcharts have been standardized by the American National
Standards Institute. Arrows are used on the connecting flowlines if the direction of
flow is not clear. A flowchart should have one start and one or more stop points and
should be arranged so that the direction of processing is from top to bottom and
from left to right. Although flowlines can cross, the crossing flowlines are
independent of each other. Whenever possible, crossing of flowlines should be
avoided, since it makes the flowchart difficult to read. Figure 2.1 shows the various
flowchart symbols and the operation that they represent. These symbols are described
in the paragraphs that follow.
Page 1 of 3
Symbol
Name
Meaning
Flowlines
Represent direction
of processing
Terminal
Input/Output
Process
Represent computations
or data manipulations
Decision
On-page connector
Off-page connector
Page 2 of 3
Terminal symbol. The terminal symbol, which is oval shaped, represents start and
end
points of an algorithm. The words START and STOP or END are usually placed as
narratives within the start and end symbols, respectively. Typically, there is only one
starting point, but there may be more than one end points, one to indicate the end of
normal processing and others to indicate an exit resulting from one or more
unrecoverable error conditions.
Input/output symbol. Both input and output operations are represented by
a
parallelogram tilted to the right. The nature of the operation to be performed is
indicated by including the terms READ and INPUT to denote input operations and the
terms PRINT and WRITE to denote output operations.
Processing symbol. The rectangular processing symbol is used to indicate operations
involving arithmetic and data manipulation. This symbol is also used to represent
a collection of statements that perform computations.
Decision symbol. The diamond-shaped decision symbol is used to indicate a point in
the
algorithm at which a branch to one or more alternative paths is possible. The
condition upon which each of the exit paths will be executed is identified within the
diamond- shaped symbol. Also, flowlines leaving the corners of the diamond are
labeled with the decision results associated with each path.
On-page connector. A small circle is used to indicate a connection between two
points
on the same page in a flowchart. For complex programs containing numerous branches
and loops, the number and direction of flowlines can result in confusion. In such
situations connectors are used to replace flowlines. Whenever possible, connectors
should be used instead of flowlines. Connectors are used in pairs, one indicating an
exit from and the other an entry to a point in a flowchart. The connector pairs are
identically labeled.
Off-page connector. Off-page connectors are used to connect flowcharts that are too
large
to fit on one page. They represent an entry, or an exit from, a point in a flowchart on
a different page. As with on-page connectors, they appear in identically labeled pairs.
Page 3 of 3