You are here

Sequence Control Structures

19 January, 2016 - 11:41

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
media/image23.png
Figure 10.12 Sequence control structure  
media/image24.png
Figure 10.13 Sequence control structured continued