Flowchart
Outline
By the end of this chapter, you will
be able to:
Solve a given problem by applying
flowchart
Understand control structures
Flowchart
Visual representation of each task
and how the tasks will flow to
produce a full program.
Shows the program logic as each
task is represented by certain
symbols, which are then connected
by lines and arrows to show the flow.
Flowchart symbols
Symbol
Terminal
Input /
Output
Purpose
Your
flowchart
should
always begin and end with
this symbol. It indicates the
starting or ending point of
the logic.
It symbolizes input (Read /
Prompt / Get) or output
(Print / Write / Put / Output /
Display)
process
in
a
pseudocode.
4
Flowchart symbols
Symbolizes any process in
Process a pseudocode. Declaring
variables, calculations and
assigning values are some
examples of a process.
This symbol indicates that
Predefined there is a module in an
process algorithm. In other words,
the
module
can
be
expended to include few
sub processes.
5
Flowchart symbols
This is used when there are
Decision decisions to be made in the
logic. When this symbol is
used, there will be options
where the logic needs to
decide which path to take.
Flow lines are used to
Flow lines connect the various symbols
that you will use in drawing
your flowchart. It indicates
the logic flow of control.
6
Control structures
There are 3 basic control structures:
Sequential
Selection
Repetition
Sequential
Straightforward execution. Process one
step after another
Basic computer operations
1.
2.
3.
4.
Receive information
Put out information
Perform arithmetic
Assign values
Add 2 numbers
START
1. Start
2. Declare variables,
number_1,
number_2, total
3. total = number_1
+ number_2
4. Display total
5. End
Declare variables
number_1,number_2,t
otal
Get
number_1,number_
2
total=number_1+num
ber_2
Display total
END
10
Selection
Condition: based on the condition
criteria, certain actions will be
executed and some will not
Condition can either be: true or false
11
Example
Say for example you are trying to
decide whether to go watch a movie
in Ipoh. However, the weather is a
factor of concern for you. If it rains,
you decide to finish up your
assignment. If it does not rain, you
will go to watch movie.
12
Flowchart
13
Repetition
Allows tasks to be done repeatedly
which can be controlled by setting
certain condition
When condition is false, the
repetition stops and the tasks will not
be executed
14
Example
I would like to add sugar into my cup
of coffee. However, that would
depend on how sweet it will taste
after each additional spoon of sugar.
15
Flowchart
Start
Not
Sweet?
FALSE
TRUE
Add Sugar
End
16
Note
Pseudocode and flowchart for
repetition and looping will be learnt
in more detail later the semester.
17