Professional Documents
Culture Documents
Program design
Topic & Structure of the lesson
•Problem Solving
• Algorithm
• Pseudocodes
• Flowcharts
Algorithm
Pseudocode
Flowchart
DEVISING A PLAN
Second: Have you seen it before? Or have you
Find the connection seen the same problem in slightly different
between the data and form?
the unknown. Do you know a related problem?
Auxiliary problems Look at the unknown! Try to think of a
may be devised if familiar problem having the same or similar
needed. unknown. Split the problem into smaller,
You should obtain simple sub-problems. If you cannot solve
eventually a plan of the proposed problem try to solve first
the solution. some related problem. Or solve more
general problem. Or special case of the
problem. Or solve the part of the problem.
CT018-3-1 Introduction To C Programming Program Design
Problem Solving
Examine the Can you check the result? Can you derive
solution the result differently? Can you use the
obtained. result, or the method, for some other
problem?
Algorithmic problem:
Any problem whose solution can be expressed as
a set of executable instructions.
Algorithm:
A well defined computational procedure consisting
of a set of instructions, that takes some value or
set of values, as input, and produces some value
or set of values, as output.
Value1 Sum
Value2
+ addition
- subtraction
* multiplication
/ division
= assignment
() brackets for grouping calculations
A Pseudocode language is semiformal, English-like
language with a limited vocabulary that can be used
to design and describe algorithms.
Another technique used in designing and representing
algorithms.
Alternative to pseudocoing
A pseudocode description is verbal, a flowchart is
graphical in nature.
Definition:
A flowchart is a graph consisting of geometrical shapes
that are connected by flow lines.
process storage
decision document
making
input/output connector
arrowheads
CT018-3-1 Introduction To C Programming Program Design Slide 63 (of 80)
Pseudocode for the Control Structures
The Sequence Control Structure:
The sequence control structure is a series of steps
or statements that are executed in the order in which
they are written in an algorithm.
For Example:
read taxable income
read filing status
compute income tax
DOWHILE...ENDDO
FOR…NEXT
REPEAT...UNTIL
:
:
: (Condition) True
ENDDO False
Action_1
An expression which
Group of determines whether Incrementation /
Decrementation
REPEAT
:
:
:
UNTIL (expression)
Read Value1,
Value2
Calculate
Sum = Value1 + Value2
Display
Sum
End
Read Amount
YES NO
Amount>20.00?
Calculate Calculate
Actual=Amount * 0.80 Actual=Amount
End
CT018-3-1 Introduction To C Programming Program Design Slide 65 (of 80)
Summary