Beruflich Dokumente
Kultur Dokumente
Hawk
Solution 6-1
Pseudocode:
start
Declarations
num index
num SIZE = 10
num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0
getReady()
Prof. Hawk
Solution 6-2
b. Modify the reverse-display program so that the user can enter up to 10 numbers
until a sentinel value is entered.
Answer:
A sample solution follows
Flowchart:
Prof. Hawk
Pseudocode:
start
Declarations
num index
num SIZE = 10
num numbers[SIZE] = 0,0,0,0,0,0,0,0,0,0
string CONTINUE = Y
string moreNumbers = CONTINUE
getReady()
while index < SIZE AND moreNumbers equal to CONTINUE
getNumbers()
endwhile
finishUp()
stop
getReady()
index = 0
output Do you want to enter a number? (Y/N)
input moreNumbers
return
getNumbers()
output Enter a number for position , index
input numbers[index]
index = index + 1
Solution 6-3
Prof. Hawk
Solution 6-4