Creating algorithms with flowcharts

<< Previous: Computational thinkng Next: Pseudocode >>

Flowcharts are a diagramatic representation of an algorithm. There are 4 symbols you need to be aware of as shown in the table below.

Shape Name Description
Processes box The process box is a rectangular box. It is used to represent processes carried out by the program that do not involve input or output e.g. assigning new values to variables, using string methods etc.
Input/output box The input/output box, sometimes shortened to io box, is a parallelogram shaped box. It is use any time data is being requested from the user and any time data is displayed to the user.
Decision box A decision box is a diamond shaped box. It is used to show a boolean check that results in the algorithm taking a different path depending on whether the boolean condition is evaluated as true or false.
Flowchart terminator A flowchart terminator is a rounded obling symbol used to indicate the start and end of an algorithm. All algorithms must have both a start and end teminator.

Flowchart example

This simple flowchart starts and ends with terminators as all algorithms do.

It receives input from the user of the price of an item and stores it as price.

If the price is over £100 then the discount variable is assigned a value of 20% and we move on to the outut stage.

If not we proceed on to check if the price is above £50. We already know it is less than £100 so we are really checking if it is between 51 and 100.

If the second check is made and it is true, discount will be assigned a value of 10% and if it is false then discount will be assigned a value of 5%.

Regardless of which path was taken from the selection structure the final step is to output the string "The discount is" followed by whatever is stored in the discount variable. Then the algorithm ends.

Blank flowchart figures for use with questions below

Knowledge check


Questions:
Correct:

Question text


<< Previous: Computational thinkng Next: Pseudocode >>

© All materials created by and copyright S.Goff