A flowchart is a visual diagram used to represent an algorithm. Each step is shown as a shape connected by arrows that show the direction of flow. Flowcharts make it easier to visualise the logic of an algorithm, especially selection and iteration.
The Edexcel 4CP0 specification requires you to know and use the following standard flowchart symbols:
| Symbol Shape | Name | Purpose |
|---|---|---|
| Rounded rectangle (oval) | Terminal | Marks the START or END of the algorithm |
| Rectangle | Process | A calculation or assignment, e.g. SET total TO total + num |
| Parallelogram | Input / Output | Receiving data from the user or displaying a result |
| Diamond | Decision | A YES/NO question; the flow branches into two paths |
| Arrow | Flow line | Shows the direction / order of steps |
A decision (diamond) symbol has one entry arrow and two exit arrows labelled YES and NO (or TRUE/FALSE). The algorithm follows one path if the condition is true, and the other if it is false.
Example: A flowchart to check if a number is positive:
A loop is shown by an arrow that goes backwards (upwards or sideways) from a later step back to an earlier step, creating a cycle. The decision diamond acts as the loop condition.
Count-controlled loop: A counter variable is incremented each time round. The decision checks if the counter has reached the target.
Condition-controlled loop: The decision checks a condition (e.g. "Has the user entered -1?"). The loop repeats until the condition is true (or false).
To interpret a flowchart: start at the START terminal, follow the arrows, and trace variable values through process boxes and decision branches. At each diamond, evaluate the condition to decide which path to follow.