Beruflich Dokumente
Kultur Dokumente
An Introduction
Pseudocode
Perform calculations
Pseudocode
READ name, hoursWorked, payRate
gross = hoursWorked * payRate
WRITE name, hoursWorked, gross
Indent to Show
Hierarchy
Selection:
Indent statements that fall inside selection structure, but not the
keywords that form the selection
Loop:
Indent statements that fall inside the loop but not keywords that
formname,
thegrossPay,
loop taxes
READ
IF taxes > 0
net = grossPay taxes
ELSE
net = grossPay
ENDIF
WRITE name, net
Language Independence
Resist the urge to write in whatever
language you are most comfortable with, in
the long run you will save time. Remember
you are describing a logic plan to develop a
program, you are not programming!
interestRate = .06
interestRate = .10
Pseudocode
no
ELSE
Interest Rate = .10
ENDIF
WHILE / ENDWHILE
count = 0
Start
count = 0
WRITE count
ENDWHILE
WRITE The End
count
<10
add 1 to
count
write count
Mainline
Write
The End
count = 0
WHILE count < 10
DO Process
Stop
ENDWHILE
WRITE The End
Process
ADD 1 to count
WRITE count
Modular
REPEAT / UNTIL
Start
count = 0
count = 0
REPEAT
ADD 1 to count
WRITE count
UNTIL count >= 10
add 1 to
count
write count
count = 0
REPEAT
count
<10
DO Process
UNTIL count >= 10
WRITE The End
Write
The End
Process
ADD 1 to count
Stop
WRITE count
Modular
Pseudocode Advantages
Easily modified
Implements structured
concepts
Done easily on Word Processor
Not visual
No accepted standard, varies from
company to company
Access of Data
The READ statement tells the computer to get a
value from an input device and store it in a
memory location.
How to deal with memory locations?
Memory locations are identified by their addresses, we
give them names (field names / variable names) using
words descriptive to us such as ctr as opposed to a
location addresses such as 19087.
Selection
+
-
add
>
greater than
subtract
<
less than
multiply
equal to
divide
>=
** or ^
exponentiation
<=
()
grouping
<>
not equal to