Computational constructsSequence

Programs run in sequences. Selection statements and loops are used in programs, allowing software to make decisions and repeat actions. These are called computational constructs

Part ofComputing ScienceSoftware design and development

Sequence

Programs follow a clear sequence. Take a brief program to convert a temperature from Celsius into Fahrenheit as an example.

Line 1 - RECEIVE celsiusTemp FROM (INTEGER) KEYBOARD

Line 2 - SET fahrenheitTemp TO (celsiusTemp * (9/5)) + 32

Line 3 - SEND fahrenheitTemp TO DISPLAY

Here are 3 lines of code.

The first line gets a temperature from the user and stores it in a variable called 'celsiusTemp'.

The second line converts the temperature from Celsius to Fahrenheit and then stores it in a variable called 'fahrenheitTemp'.

The third line displays the converted temperature.

Line 1 would run, then line 2, then line 3. The program would not try to run the code on line 3 before the code on lines 1 and 2.

Converting temperature by using an application on a mobile device.

Computer systems rely heavily on the input, process, output cycle. In the temperature conversion example, the three steps were:

InputLine 1 - Get the user to input the temperature in Celsius
ProcessLine 2 - Process the temperature into Fahrenheit
OutputLine 3 - Output the temperature in Fahrenheit to the screen
Input
Line 1 - Get the user to input the temperature in Celsius
Process
Line 2 - Process the temperature into Fahrenheit
Output
Line 3 - Output the temperature in Fahrenheit to the screen
The process of converting a temperature from Celsius to Fahrenheit.

The input, process, output cycle is often evident in our everyday use of computer systems. On a mobile phone, when you press a character key when typing a message, the software on your phone takes that input, processes it and then outputs the character on screen.