3 Program Flowchart Lecture
3 Program Flowchart Lecture
ANALYZE
DOCUMENTATION
Define the
Describe the problem.
program.
DEBUG
Program
DESIGN
AND TEST
Locate and remove any Plan the solution to
errors in the program.
Development the problem.
Cycle
CODE INTERFACE
Translate the algorithm Select the objects
into a programming (programming
language. language).
Topic Discussion: Flowchart CPEN21A – PROGRAMMING LOGIC AND DESIGN
WHAT IS A FLOWCHART?
• Program flowchart is a diagram that uses a set of standard graphic
symbols to represent the sequence of coded instructions fed into a
computer, enabling it to perform specified logical and arithmetical
operations.(www.edrawsoft.com)
WHAT IS A FLOWCHART?
•A flowchart is a diagram that depicts a process, system or computer
algorithm. They are widely used in multiple fields to document, study,
plan, improve and communicate often complex processes in clear,
easy-to-understand diagrams. (www.lucidchart.com)
TYPES OF FLOWCHARTS?
Program Flowcharts.
• These are used by programmers.
• It is graphical description of sequence of logical operations
performed by the computer in a computer program. PFC are drawn
by use of specific symbols.
•A program flowchart shows the program structure, logic flow and
operations performed.
• The emphasis in a program flowchart is on the logic.
Topic Discussion: Flowchart CPEN21A – PROGRAMMING LOGIC AND DESIGN
TYPES OF FLOWCHARTS?
System Flowcharts.
• System flowcharts are used by system analyst to show various
processes, sub systems, outputs and operations on data in a
system.
• It is graphical description of relationships among the inputs,
outputs and processes in an IS (modeling systems in physical
terms). SFC are drawn by use of specific symbols.
Topic Discussion: Flowchart CPEN21A – PROGRAMMING LOGIC AND DESIGN
TYPES OF FLOWCHARTS?
DFD (Data Flow Diagrams)
• It shows how the data moves within a system. DFD are also drawn
by some specific symbols.
Topic Discussion: Flowchart CPEN21A – PROGRAMMING LOGIC AND DESIGN
PROCESSING OPERATION:
• Arithmetic Calculation
• Reading Input
• Producing Output
• Comparison
• Moving data
• Initializing value
• Branching and Looping
• Modular Technique
Topic Discussion: Flowchart CPEN21A – PROGRAMMING LOGIC AND DESIGN
DESK CHECKING
• The process of testing the flowchart with different data as input,
and checking the output.
FLOWCHART SYMBOLS
START
Read Hours,
PayRate
• Used to
Multiply Hours
connect by PayRate.
Store result in
FLOW LINES symbols and GrossPay.
END
FLOWCHART SYMBOLS
START Terminal
END
a task. Display
GrossPay
Terminal END
FLOWCHART SYMBOLS
pi = 3.1416 • Used to set
num = 0
initial/ constant
value in an
identifier name.
INITIALIZATION/
T for i in F
LOOPING BOX • Used to evaluate
range(3) the looping
condition.
FLOWCHART SYMBOLS
START
• Used for input
and output Read Hours,
Read Hours, operations, such PayRate
PayRate
as reading and
displaying. Multiply Hours Input and
by PayRate. Output
Store result in
INPUT/OUTPUT
Operation
Display
• The data to be GrossPay.
FLOWCHART SYMBOLS
START
Read Hours,
• Used for PayRate
arithmetic and
Multiply Hours data manipulation Multiply Hours
by PayRate.
by PayRate. operations. Store result in Process
Store result in PROCESS • The instructions GrossPay.
END
FLOWCHART SYMBOLS
On-page connector
START A
FLOWCHART SYMBOLS
• Used to
indicate that
1 OFF-PAGE the flowchart
CONNECTOR continues to
a second
page.
FLOWCHART SYMBOLS
START
• Used to
represent a Read Input.
group of
statements that
Call PREDEFINED perform one Call calc_pay Predefined
processing task. function. process
calc_pay
function
PROCESS •A separate
flowchart can be Display results.
constructed for
the module.
END
FLOWCHART SYMBOLS
• Used to
provide
Process
additional description
information
ANNOTATION
about another
flowchart
symbol
The Decision symbol has two exit All flow charts start with a Terminal
3 points; these can be on the sides 7 or Predefined Process (for interrupt
or the bottom and one side. programs or subroutines) symbol.
STRUCTURE OF A FLOWCHART
START
Read Input.
Call calc_pay
function.
Display results.
END
Topic Discussion: Flowchart CPEN21A – PROGRAMMING LOGIC AND DESIGN
FLOWCHARTS FOR
COMPUTATIONS (SEQUENCE)
• Computers are used to perform many calculations at high speed.
When you develop a program it also involves several calculations.
• The general format of the flowcharting steps for computations is :
• Create identifier used in calculations and read operation.
• Get required data input using identifier.
• Perform the necessary calculations.
• Print the result.
PROGRAMMING CONSIDERATIONS
WHILE USING COMPUTATION
TECHNIQUES
• Most languages have provision for creating identifier.
• The exact syntax depends on the language used.
• In most cases (but not all) your programs have to create and initialize
the identifier before you can use them.
• Write an algorithm and draw a flowchart that takes two numbers and
prints the quotient and remainder.
• Write an algorithm and draw a flowchart that takes both the values
from the user and swaps them without using temporary variable.
Topic Discussion: Flowchart CPEN21A – PROGRAMMING LOGIC AND DESIGN
• There are two types of loops. One is known as the fixed loop where
the operations are repeated a fixed number of times. In this case, the
values of the variables within the loop have no effect on the number of
times the loop is to be executed.
• The test could either be to determine whether the loop has executed
the specified number of times, or whether a specified condition has
been met.
PROGRAMMING CONSIDERATIONS
WHILE USING LOOP TECHNIQUES
• Most of the programming languages have a number of loop constructs
for efficiently handling repetitive statements in a program. These
include :
• while loop
• for loop