Lecture 05-PseudoCode
Lecture 05-PseudoCode
Lecture 05-PseudoCode
• To describe pseudocode
• To show examples of pseudocode
• To practice using pseudocode
• To compare pseudocode with flowcharts
Pseudocode
Pseudocode
READ name, hoursWorked, payRate
gross = hoursWorked * payRate
WRITE name, hoursWorked, gross
Indent to Show Hierarchy
Each design structure uses a particular indentation pattern
WHILE/ENDWHILE
REPEAT/UNTIL
WHILE / ENDWHILE
Start
count = 0
WHILE count < 10
ADD 1 to count
count = 0
WRITE count
ENDWHILE
WRITE “The End”
count
Mainline
<10 Modular
count = 0
Write WHILE count < 10
add 1 to “The End”
count DO Process
ENDWHILE
Stop WRITE “The End”
write count
Process
ADD 1 to count
WRITE count
REPEAT / UNTIL
Start count = 0
REPEAT
count = 0
ADD 1 to count
WRITE count
UNTIL count < 10
add 1 to WRITE “The End”
count
Mainline Modular
write count count = 0
REPEAT
DO Process
count
<10 UNTIL count < 10
WRITE “The End”
Write Process
“The End”
ADD 1 to count
Stop WRITE count
Advantages & Disadvantages
Flowchart Advantages: Pseudocode Advantages
Standardized Easily modified
Visual Implements structured concepts
Done easily on Word Processor
Flowchart Pseudocode
Disadvantages: Disadvantages:
Hard to modify
Not visual
Structured design elements not
No accepted standard, varies from
implemented
company to company
Special software required
Quiz 1
Time Allowed: 15
min
Q1. Draw a flow chart to find the largest
of three numbers and print it? [6]