Use stepwise refinement to design a program that finds the maximum value from among a list of data. Refine your design along the lines of the examples in Section 7-5 until you arrive at a version similar to example 6. Be sure your final design can handle a mixture of positive and negative data between the values +1000 and —1000.
What will be an ideal response?
```
LET count = 0
INPUT num
LET max = num
DO UNTIL num = 9999
IF num > max THEN LET max = num
LET count = count + 1
INPUT num
LOOP
IF count > 0 THEN
OUTPUT "The maximum value in the data list is ", max
ELSE
OUTPUT "The data list is empty."
END IF
```
Note: Choosing the initial value of the variable max must be done carefully. An initial value of zero would prevent finding the maximum of a list of numbers all less than zero. The best choice for the initial value is the first data item, the one read by the priming read.
You might also like to view...
What is the output of the following code?
``` inline void print(int i) { cout << i << endl; } int main() { print(1); inline void print(int i) { cout << i << endl; } int main() { print(1); return 0; } /code} A. max is 2 B. max is 0 C. max is D. max is 1
Method addSeparator adds a separator ___________ to a menu.
a) bar b) mnemonic c) submenu d) menu item
As your website grows, so will the number of links on it.
Answer the following statement true (T) or false (F)
Trace through the binary search algorithm in findInSortedList given the following input.
What will be an ideal response?