
Available under Creative Commons-ShareAlike 4.0 International License.
The next item is pseudocode for a simple temperature conversion program. This demonstrates the use of both the on-page and of-page connectors. It also illustrates the sequence control structure where nothing unusually happens. Just do one instruction after another in the sequence listed.
Example 10.11: pseudocode: Sequence control structure
Filename: Solution_Lab_04_Pseudocode.txtPurpose: Convert Temperature from Fahrenheit to CelsiusAuthor: Ken Busbee; © 2008 Kenneth Leroy BusbeeDate: Dec 24, 2008 Pseudocode = IPO Outline input display a message asking user for the temperature in Fahrenheit get the temperature from the keyboardprocessing calculate the Celsius by subtracting 32 from the Fahrenheit temperature then multiply the result by 5 then divide the result by 9. Round up or down to the whole number. HINT: Use 32.0 when subtracting to ensure floating-point accuracy.output display the celsius with an appropriate messagepause so the user can see the answer

Figure 10.12 Sequence control structure

Figure 10.13 Sequence control structured continued
- 瀏覽次數:6370