Flowcharting is an alternative method for documenting the logic of a solution algorithm, compared to pseudocode. Flowcharting uses graphics symbols rather than text to describe the logic of the solution. It has advantages and disadvantages relative to pseudo-code.
|Used to start and
stop a code block.
The text it contains is one of :
1. the name of the module it starts
2. the keyword 'End', which is used only once in a program
3. the keyword 'Return', used at the end of modules to transfer control back to the calling module
NOTE: The text to be used here is NOT what you see in the Robertson textbook.
|Used to represent a process or a single step in an
The text it contains is the name or the description of a simple process.
Use this only for simple processes.
|Used to represent a pre-defined process.
The text it contains is always a descriptive name of the process it represents.
The process that it represents must be described separately.
|The decision symbol represents a true / false question
that controls the flow of the program logic.
It should contain the text of the condition that it represents.
The top vertex of the decision symbol represents its entry point.
There should only be two lines exiting the symbol. These represent the logic paths to be followed for the true or false states as appropriate. Always used in selection or repetition structures described below.
|Flowlines connect the other symbols to show the flow of logic control from one part of the solution to another. The arrowhead is only necessary when lines meet or the flow of control is NOT from top to bottom, or left to right|
There are some standard ways of connecting the symbols to represent the three basic structures. Notice that each of the three basic structures has a single entry flow and a single exit flow.
Steps that execute in sequence are represented by symbols that follow each other top to bottom or left to right. Top to bottom is the standard. Any one of the processes could be replaced by another structure (for example, a single process "box" could be replaced by a sequence of two process "boxes").
Once the condition is evaluated, the control flows into one of two paths. Once the conditional execution is finished, the flows rejoin before leaving the structure. Once again the single entry, single exit nature of a structure is evident. Either process could be replaced with any structure (sequence, selection, or repetition) or it could be omitted (for example the process on the "NO" side might not exist).
As an alternative, the "Question" could be replaced with aBoolean expression and the branches labelled "TRUE" and "FALSE".
Either the processing repeats or the control leaves the structure. (Again, the process could be replace another structure).
Notice that the return line joins the entry line before the question. Never try to insert processing in the entry line between the join and the question.
|Design a solution algorithm that will read a Student Information file and produce a 'PART TIME FEMALE STUDENTS' report, listing the student ID, name, program of study, and academic achievement level. In addition, you are to display at the end of the report the number of students who have been selected and listed, and the total number of students in the file.|
The Student Information consists of records which contain:
- ID number (int)
- age (int)
- gender (char)
- program (char)
- academic level (int)
- attendance pattern (char),
i.e. full time (F/T) or part time (P/T)
The report has the heading 'PART TIME FEMALE STUDENTS', and includes the student's ID number, name, program, and academic level for each part-time, female student.
Display report headings
Read student record
Display part-time, female student record details
Display total selected students
Selected Student Records
Total selected students
This is a problem that involves processing a file.
The basic file processing algorithm includes these steps:
We can start with the following flowchart to describe the basic file processing steps:
This diagram only covers our basic file processing steps. Obviously, there are still details to be added to the general flowchart, based on the specific requirements of this problem.
We need to add the processing steps concerning our report and the processing of the individual students.
There are now two selections as well as the file processing loop, and the selection of the Part-time female students for the report has been looked after.
A good flowchart presents a clear picture of the activities to be performed,
using recognizable flow controls; but when "a flowchart goes bad"... it can
go really, really bad! Compare the earlier (relatively "good") flowchart
for processing "part-time, female students" with the following example:
This logic was probably developed, with a narrow focus: "Once I've done this, what do I need to do next?" approach, instead of trying to identify significant flow control structures and filling in the details later.
The resulting logic has two terminal points (invalidating a basic structured programming concept) and contains a "looping" structure which can not be implemented with any standard program sequence control statements.
| (One more time... with feeling...
Uses Text Processor
Difficult to understand complex logic
Harder to see 'Big Picture' in complex solutions
especially if alignment is poor and/or
if "nesting" of structures is deep
|Flowcharts||A picture is worth a 1000 words....
Good 'Big Picture' visibility
(if standard structures are used
and the logic can be represented in a single page)
Requires template or special software
Permits development of logic sequences
which can NOT be coded
using valid structured code