Pseudo-code
Pseudo-code is a simple way of describing a set of instructions in a manner that resembles a programming language. In an algorithm, most processes fall into three main categories:
- inputData which is inserted into a system for processing and/or storage.
- processAn action taken by the program without input from the user.
- outputData which is sent out of a system.
When pseudo-code is being written, inputs, processes and outputs can be identified using the key words in the code.
For example, if a person was writing a program where a number is input and the program calculates and outputs the times table up to ten, they could write a statement like this:
The user INPUTS a number which is saved as num
FOR each number from 1 to 10, OUTPUT num*number
This could be improved by writing the pseudocode:
num 鈫 USERINPUT
FOR number 鈫 1 TO 10
OUTPUT number * num
ENDFOR
The 鈫
symbol in pseudo-code means assignmentSetting the value of a variable in a computer program.. Most programming languages use = instead of 鈫
. In the example above, num 鈫 USERINPUT
means that the user input is being put into, or assigned to, the variableA memory location within a computer program where values are stored. called num
.
Outputs use the word OUTPUT
before the dataUnits of information. In computing there can be different data types, including integers, characters and Boolean. Data is often acted on by instructions. to be sent to the user. In the example above, the line OUTPUT number * num
in Python might look like print (number * num)
.
Processing refers to any operation the computer system is performing on data, for example doing a calculation or searching for something. In OUTPUT number * num
, the program is actually performing a calculation within the output, so it is possible to see statements which combine one or more of these.
Flowcharts
A flowchart is a diagram that shows an overview of an algorithm. Flowcharts use a variety of standardAn agreed way of doing things. symbols to represent different elements, and arrows to show the flow or direction. These symbols are used to construct the flowchart and show the step-by-step solution to the problem.
Common flow diagram symbols