|
|
|
|
|
|
|
following words. A gap is defined as one or more spaces in a row, so a sequence of spaces counts as just one gap. The newline character also counts as a gap. Anything other than a space or newline is considered to be part of a word. For example, there are 19 words in the following hint, according to our definition. (Hint:Only count a space as a gap if the previous character read is something other than a space.) The program should echo-print the data. |
|
|
|
|
|
|
|
|
Use meaningful variable names, proper indentation, and appropriate comments. Thoroughly test the program with your own data sets. |
|
|
|
|
|
|
|
|
1. Modify the TempStat program to work with any number of temperature readings, using a temperature of -999 to signal the end of the data. What type of eventcontrolled loop does your solution employ? |
|
|
|
|
|
|
|
|
2. If we want the program to input any number of temperature readings and still use a count-controlled loop, how would we revise the program and input data? |
|
|
|
|
|
|
|
|
3. In the Shipping Invoices case study, identify the two types of loop used. |
|
|
|
|
|