Introduction

There are a number of ways to write an algorithm. One way is to use a flowchart. We will describe the symbols used in a flowchart and give an example of their use.

There are a number of ways to write an algorithm. One way is to use a flowchart. We will describe the symbols used in a flowchart and give an example of their use.

Symbols

The following symbols are the most common ones used in flowcharts, although there are others and if you read around this topic, you may find slight variations in their use.

The following symbols are the most common ones used in flowcharts, although there are others and if you read around this topic, you may find slight variations in their use.

An example of a flowchart

Suppose you had to write an algorithm to input two numbers and output them in size order, with the smallest one first. A flowchart describing this is as follows:

Suppose you had to write an algorithm to input two numbers and output them in size order, with the smallest one first. A flowchart describing this is as follows:

Follow the flow when you enter 5 and then 10 (so A = 5 and B = 10).

Now follow the flow when you enter 10 and then 5 (so A = 10 and B = 5).

Now follow the flow when you enter 10 and then 5 (so A = 10 and B = 5).

We begin and end with the Start / End symbol. We then have to input some data. We then do a test. There are two outcomes to the test, yes or no (TRUE or FALSE). Depending on the result of the test, we set two variables. We then output them and stop.

An example of a FOR loop and using subroutines

Suppose you had to carry out a set of instructions a fixed number of times. In programming code, you would use a FOR loop for this. But stepping back for a moment, how might you represent this as a flowchart?

Suppose you had to carry out a set of instructions a fixed number of times. In programming code, you would use a FOR loop for this. But stepping back for a moment, how might you represent this as a flowchart?

There are some useful tools for making flowcharts around. There is a drawing toolbar in both Word and OpenOffice that can be used for drawing neat flowcharts. Meesoft's 'Diagram Designer' is also excellent (and free). If your school has Logicator, that's also an excellent way of getting experience producing good flowcharts

## No comments:

## Post a Comment

Wildern Pupils if you log onto your school email account you can leave a comment via that ID.