fbpx

Flowcharts

Before beginning to code any algorithm, programmers will use a range of techniques to work out how the algorithm is going to work and what different programming statements they will need. Another design technique that is available to the program designer is the Flowchart Diagram.

A flowchart is a common set of symbols used all over the world which have been agreed by the British Computer Society to all mean the same thing, and they are used as a means of using drawings to show how programs function.

In this lesson, we’ll learn about:

  1. What a flowchart is
  2. What the standard symbols of a flowchart are
  3. How flowcharts relate to pseudocode
Media Attachments: Presentation Video

1. What a Flowchart Is

We have been seen how code can be expressed as pseudocode – which is like a simple description of how a program can function.

The code below shows a very simple piece of pseudocode for entering two numbers into a program, multiplying them together and then outputting the result.

firstNumber ← USERINPUT
secondNumber ← USERINPUT
result ← firstNumber * secondNumber
OUTPUT result

Now, while this code might make sense to a programmer, it might not make any sense to someone with no programming experience at all.

Sometimes other people will need to see what a program aims to do and they may not be software engineers.

Such people may be the client, the end-user of the program, a project manager or a business analyst. These people would not be able to read and understand pseudocode or actual code, especially code that gets more complex.

That is why Flowcharts exist – they are a simple way for non-programmers to see how a piece of software works.

Flowcharts are themselves a language. Anybody who has seen a flowchart will be able to read, follow and understand it. That makes flowcharts a very powerful tool for communicating ideas.

There are many tools available for constructing flowcharts. Two of the most popular are Microsoft Visio and the online tool https://www.draw.io/.

The flowchart for the pseudocode shown above is shown in figure 1 below.

A simple flowchart for multiplying two input numbers.
Figure 1 – a simple flowchart for multiplying two input numbers.

Flowcharts can also be used by programmers to quickly see how programs should work and help solve problems in code. We will look at the symbols used as well as how to construct flowcharts from pseudocode in the following sections.

Further Thought

Can you think of any other types of people who might prefer to look at a programming solution as a diagram instead of pseudocode?

2. What are the Standard Symbols of a Flowchart

What are the Standard Symbols of a Flowchart

All flowcharts use the same symbols for different parts of the program. These symbols have been approved by the British Computer Society (BCS) and are standard across the world.

SymbolNameDescription
Flowchart Connector SymbolConnectorThese show the direction of the flow in your diagram, sometimes known as the “flow of control”.

These will always start at one symbol and end at another with an arrowhead showing the direction of flow.
A terminal flowchart symbolTerminalThese symbols represent the start and end of our flowchart (or program).

Both Begin and End use the same shape which is a flattened circle with a connector either going out of it (Begin) or into it (End).
Input / OutputJust like begin and end, Input and Output use the same shape, a flattened rectangle (or parallelogram).

You can tell which is input and output by the text inside the rectangle.
ProcessA process is where your program does something that is not input or output.

A process could be a mathematical calculation, a database check, or searching for something in a list.

In a flowchart, a process uses a square box with text describing what the process does.
DecisionA decision is drawn as a diamond that will always have one connector going into it and two connectors coming out of it.

The decision represents a question that your code is asking (or an If statement in your code). The two connectors coming out are what to do if the answer is Yes, and what to do if the answer is No.
Sub ProgramA sub program is another process that is defined elsewhere. This might have its own separate flowchart.

In programming, this could represent a subroutine or function. This is like a block of code that is designed to perform a frequently used process.

Further Thought

How could use these symbols to represent common programming commands like an IF…ELSE statement?

3. How Flowcharts relate to Pseudocode

How Flowcharts relate to Pseudocode

Flowcharts are a simple graphical way of representing pseudocode as a drawing. It should be possible for our flowchart to almost exactly match our pseudocode.

For example, take a look at the pseudocode we used in part 1 of this lesson and we will see how the flowchart matches the pseudocode.

firstNumber ← USERINPUT
secondNumber ← USERINPUT
result ← firstNumber * secondNumber
OUTPUT result

Let’s start by looking at line 1 of the pseudocode.

firstNumber ← USERINPUT

This matches the following parts of the flowchart:

Notice we have the BEGIN and the INPUT. The begin just represents the start of the program. Sometimes in pseudocode we’ll include a BEGIN at the start of the pseudocode too.

Now we can look at line 2 of the pseudocode.

firstNumber ← USERINPUT
secondNumber ← USERINPUT

This matches the following parts of the flowchart:

Again, this matches the pseudocode very closely. We have input the second number and stored it in a variable called secondNumber.

Now we can look at line 3 of the pseudocode.

firstNumber ← USERINPUT
secondNumber ← USERINPUT
result ← firstNumber * secondNumber

This matches the following parts of the flowchart:

While this looks a little different, as the flowchart is more descriptive, you can see it does the same thing. We multiply firstNumber and secondNumber and store the result in a variable called result.

Now we can look at line 4 of the pseudocode. Our final line of code.

firstNumber ← USERINPUT
secondNumber ← USERINPUT
result ← firstNumber * secondNumber
OUTPUT result

This matches the following parts of the flowchart:

A simple flowchart for multiplying two input numbers.

This flowchart matches our pseudocode closely. We simply output the result to our user and the program ends. Much like with the BEGIN, the END in a flowchart just shows the end of the diagram and we sometimes have an END statement at the end of our pseudocode too.

It’s easy to see here how our flowchart matches our pseudocode almost exactly. It just presents it in an easier to understand graphical form.

Further Thought

Can you construct a flowchart from any of the other pseudocode algorithms we have used so far in this course?

Lesson Summary

So to summarise what we’ve learnt in this lesson:

  • Flowcharts are a simple graphical way for a non-specialist to look at pseudocode.
  • All flowcharts use the same symbols for different parts of the program. These include:
    • Connectors
    • Begin / End symbols
    • Input / Output symbols
    • Process symbols
    • Decision symbols
  • It should be possible for our flowchart to almost exactly match our pseudocode.
Quizzes
Scroll to Top
Send this to a friend