0% found this document useful (0 votes)
13 views41 pages

Flow Chart

Uploaded by

Joshua Perez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views41 pages

Flow Chart

Uploaded by

Joshua Perez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

Introduction

To
Flowchartin
g
Today’s topic
• Flowchart
Symbols
• Structures
• Sequence
• Selection
• Repetition
Flowcha
rt:
Represents an
algorithm
in graphical symbols
Flowchart
A flowchart is a visual representation of the
sequence of steps and decisions needed to
perform a process. Each step in the
sequence is noted within a diagram shape.
Steps are linked by connecting lines and
directional arrows
PREPARATION ROUTINES OF
STUDENTS

WAKE UP EAT BREAKFAST SHOWER GO TO SCHOOL


LOG-IN PROCESS

INPUT
LOG IN PAGE USERNAME AND CLICK LOG-IN MAIN - PAGE
PASSWORD
LOG IN PAGE

INPUT
USERNAME AND
PASSWORD

LOG-IN PROCESS
CLICK LOG-IN

MAIN - PAGE
FLOWCHART SYMBOLS

FLOWCAHRT NAM OF SYMBOL FUNCTION/PROCESS


SYMBOL

Start/Stop Symbol The terminator symbol marks the starting or ending


Begin/End Symbol point of the system. It usually contains the word
"Start" or "Stop. Or Begin or End"

Action or Process Process: Used whenever data is being manipulated.


Symbol One flow line enters and one flow line exits.

Decision Symbol A decision or branching point. Lines representing


different decisions emerge from different points of
the diamond.

Represents material or information entering or


Input/Output Symbol leaving the system, such as customer order (input)
or a product (output).

Connector Symbol/ Indicates that the flow continues where a matching


On-Page Connector symbol (containing the same letter) has been placed.
FLOWCHART SYMBOLS

FLOWCAHRT NAM OF SYMBOL FUNCTION/PROCESS


SYMBOL

Off Page Connector Indicates that the process continues off page.

Indicates a sequence of actions that perform a


Subroutine Symbol specific task embedded within a larger process. This
sequence of actions could be described in more
detail on a separate flowchart.

Comment Used to add description or clarifications.

Flowline Used to indicate the direction of flow control


FLOWCHART SYMBOLS

FLOWCAHRT NAM OF SYMBOL FUNCTION/PROCESS


SYMBOL

Document Symbol A printed document or report.

Multiple Documents Represents multiple documents in the process


Symbol

Manual Input Symbol Represents a step where a user is prompted to enter


information manually.

Preparation Symbol Represents a set-up to another step in the process.

Or Symbol Indicates that the process flow continues in more


than two branches.
FLOWCHART SYMBOLS

FLOWCAHRT NAM OF SYMBOL FUNCTION/PROCESS


SYMBOL

Summoning Junction Indicates a point in the flowchart where multiple


Symbol branches converge back into a single process.

Merge Symbol Indicates a step where two or more sub-lists or sub-


processes become one.

Collate Symbol Indicates a step that orders information into a


standard format.

Indicates a step that organizes a list of items into a


Sort Symbol sequence or sets based on some pre-determined
criteria.

Delay Symbol Indicates a delay in the process.


FLOWCHART SYMBOLS

FLOWCAHRT NAM OF SYMBOL FUNCTION/PROCESS


SYMBOL

Data Storage or Indicates a step where data gets stored.


Stored Data Symbol

Database Symbol Indicates a list of information with a standard


structure that allows for searching and sorting.

Display Symbol Indicates a step that displays information.


Comments or
Start
description

Read N, N = The number of students


M M = The number of
subjects

Yes

No

Stop
Connectors on the same
page
Start

1 2

1connection on the
same flowchart
portion

2 connection on the
Stop
different
1
flowchart portion

2
Connectors on a different
page Page
Page 1 2

Start

2
1

Stop
Yes 1

No

2
The detail of how the function
works
is put in another flowchart.
This is known as Function-
Functio Definition
n Page Start terminal for a Page
1 Function is 2
Start different. Do not
use “Start”
AVRG ( result,n1, n2,n3)

Read
n1, n2 , n3

sum = n1+ n2+n3

Body of a function
AVRG (result, n1, n2,n3) is the same with
normal flowchart

At this point, result = sum/3


we only focus on
what
to do. How to do Print
result
it, it comes later.
This part is known
as Return
Function-Call

Stop
End terminal
must be a “Return”

This flowchart calculates the average of three


numbers
LOG-IN PROCESS
The main
flowcharting
structures
1.Sequence
2.Selection

3.Repetition
A flowchart expressing the solution to an involved
problem may have:
1. the main program flowchart on one page
2. with subprograms continuing the problem
solution on subsequent pages.
Each of the five acceptable
structures can be built from
the basic elements as shown
below.
Each of the five acceptable
structures can be built from
the basic elements as shown
below.
Each of the five acceptable
structures can be built from
the basic elements as shown
below.
Sequen
ce
In a computer program or an algorithm,
sequence involves simple steps which are
to be executed one after the other.
The steps are executed in the same order in which they
are written.
In a flowchart,
sequence is expressed as:
In pseudocode,
sequence is expressed as:

process 1
process 2


process n
Sequen
ce
An Example
Problem: Using
Write a setSequence
of instructions that describe how to make a pot of tea.

Pseudocode Flowchart

BEGIN
fill a kettle with water
boil the water in the kettle
put the tea leaves in the pot
pour boiling water in the
pot
END
Selection is used in a computer
program or algorithm
to determine which particular step or set
of steps is to be executed
Binary Selection Binary Selection

In pseudocode, binary selection In flowcharts, binary selection is expressed in


is expressed in the following the following ways:
ways:

1. IF condition THEN
process 1
ENDIF

2. IF condition THEN
process 1
ELSE
process 2
ENDIF
Selection
Binary
(structure)
Binary Selection Binary Selection

In pseudocode, binary In flowcharts, binary selection is expressed in


selection is expressed in the the following ways:
following ways:

1. IF condition THEN
process 1
ENDIF

2. IF condition THEN
process 1
ELSE
proc
ess 2
ENDIF
Selection
Binary ( flowchart structure)
Note: In a flowchart it is most important to indicate
1. which path is to be followed when the condition is true, and
2. which path to follow when the condition is false.
Without these indications the flowchart is open to more than one interpretation.

Note: There are two acceptable ways to represent a decision in all of the
structures.
Either method is acceptable. For consistency, the method 1 is used throughout this
1. The condition is expressed as a
document. 2. The condition is expressed as a
statement and the two possible question and the two possible outcomes
outcomes are indicated by are indicated by
• True • Ye
• False s
• No
Selection
Binary (examples)
Selection is used in a computer program or algorithm
to determine which particular step or set of steps is to be executed.

Examples Using Binary Selection


Problem 1: Write a set of instructions to describe when to answer the phone.

Binary Selection
Flowchart
Binary Selection
Pseudocode

IF the telephone is ringing THEN


answer the telephone
ENDIF
Selection
Binary (examples)
Examples Using Binary Selection
Problem 2: Write a set of instructions to follow when approaching a set of traffic
control lights.
Binary Selection
Flowchart
Binary Selection
Pseudocode

IF the signal is green


THEN
proceed through the
intersection
ELSE
stop the vehicle
ENDIF
Selection
Multi-way
(structure)
Multi-way Selection Multi-way Selection

In pseudocode, multiple selection In flowcharts, multi-way selection is


is expressed as: expressed as:
CASEWHERE expression
evaluates to
choice a : process a
choice b : process b
. .
. .
. .
OTHERWISE : default
process
ENDCASE

Note: As the flowchart version of


the multi-way selection indicates,
only one process on each pass is
executed as a result of the
implementation of the
Selection
Multi-way (examples)
Example Using Multi-way Selection
Problem: Write a set of instructions that describes how to:
respond to all possible signals at a set of traffic control lights.
Multi-way Selection
Multi-way Selection Flowchart
Pseudocode

CASEWHERE signal is
red : stop the
vehicle
amber : stop the

vehicle : proceed
through
green the intersection
OTHERWISE :
proceed
with
caution
Repetiti
on
Repetition allows for a portion of an algorithm or computer program
to be done any number of times
dependent on some condition being met.
An occurrence of repetition is usually known as a loop.

An essential feature of repetition is that


each loop has a termination condition
to stop the repetition,
or the obvious outcome is that
the loop never completes execution (an infinite loop).

The termination condition can be checked or


tested
1. at the beginning and is known as a pre-
test loop or
2. at the end of the loop and is known as a
post-test loop.
Repetiti
on (structure)
Pre-test
Repetition: Pre-Test
A pre-tested loop is so named because the condition has to be met at
the very beginning of the loop or the body of the loop is not
executed.
This construct is often called a guarded loop.
The body of the loop is executed repeatedly while the termination condition is true.
Repetition

Repetition In flowcharting
pre-test repetition
In pseudocode, pre-test is expressed as:
repetition is expressed as:

WHILE condition is true


process(es)
ENDWHILE
Repetition Post-test
(structure)
Repetition: Post-Test
• A post-tested loop executes the body of the loop before testing the termination condition.
• This construct is often referred to as an unguarded loop.
• The body of the loop is repeatedly executed until the termination condition is true.
An important difference between a pre-test and post-test loop is that the statements of a post-test lo
least once even if the condition is originally true, whereas the body of the pre-test loop may never be
termination condition is originally true.

A close look at the representations of the o loop types makes this point
tw Repetition
apparent.

Repetition In a flowchart
post-test repetition
In pseudocode, post-test is expressed as:
repetition is expressed
as:

REPEAT
process
UNTIL condition is true
Repetition Pre-test
(example)
An Example Using Pre-Test Repetition
Problem: Determine a safety procedure for travelling in a carriage on a moving
train.

Pre-test Repetition
Flowchart
Pre-test Repetition
Pseudocode

WHILE the train is moving


keep wholly within
the carriage
ENDWHILE
Repetition Post-test
(example)
An Example Using Post-Test Repetition
Problem: Determine a procedure to beat egg whites until fluffy.

Post-test Repetitio n
Flowchart

Post-test Repetition
Pseudocode

REPEAT
beat the egg whites
UNTIL fluffy
Exampl
e:
Start

Read
Length,
Inpu
Width t:
Length <-
5
Width <-
3

Calculate Area
Process:
Area=Length * Width
Area = 5 * 3 =
15

Calculate Perimeter Process:


Perimeter= Perimeter =
2 * (Width+Length) 2* (5+3)
= 16 Outpu
t
Area: 15
Print
Area, Perimeter: 16
Perimeter

Stop
Example:
What is the output of the following flowchart when the input
Num= 10
Start
Enter a Number >> 10

Category A
Input:
Read Num
Num <-
Num = 1010
10 > 0 ? =>
YES

Num>0? No

Print
"Category B"
Yes

Print
Output:
"Category A"
“Category
A”

Stop
Example:
What is the output of the following flowchart when the input is
Num= 0

Start
Enter a Number >> 0
Category B
Read Num Input: Category
Num = Num <- Outpu A
0 > 0 ? 0=> t:
“Category
NO B”
Num>0? No

Print
"Category B"
Yes

Print
Output:
"Category A"
“Category
A”

Stop
Exampl
What
e: is the output of the following flowchart when the input is
Num= 4
Start Variables
Variables(in
Variables (in
(in
memory):
memory):
memory):
Num [ 4 ]
Read Num Input: Result
Num [ 4[ 10]
Num
Num ] [[[ 4449 ]+]] 1
Num <- [Count
4 ] [[[ 4
Result
Result
]Result 70
09 ]]] 0417 ++-+ 4321
4
Count [ 4 []
Result
Count
Count
Count [[ 321 ]]]
Initialize 3
]2 -
-
4 - 11
1
Result=0 Count [
Count=Num
]
Enter a Number => 4
Print Count Count: 4
CCoCououn
04132>>>000??
Count: 3
untnt==41
? Count: 2
03
=
2= >=>> Y Y
= > Y N Count>0?
Result=Result + Count
Count: 1
Yes

EEYOESSESS
Count=Count - 1 Count: 0
No
Result: 10

Print
Result

Stop
Exampl
What is the output of the following flowchart when the input is
e:
N= 6

10 5
Page 1 avera Page
2 ge
Start
N=6
AVRG ( result,n1, n2,n3)

Read
N Sum = 10 + 5
+6
sum = n1+ n2+n3

AVRG (average, 10, 5, N) average


= 21/3

result = sum/3

Print
average Output:
Average:
7
Return

Stop

You might also like