Topic 7 · Algorithm design and problem-solving
Flowcharts
The standard flowchart symbols, how to draw selection and loops, and how a flowchart becomes pseudocode.
The symbols
Each shape has one meaning. Arrows (flow lines) show the order the steps run in.
| Shape | Name | Used for |
|---|---|---|
| Rounded rectangle | Terminator | START and STOP |
| Rectangle | Process | Calculations and assignments, such as Total ← Total + Mark |
| Parallelogram | Input / output | INPUT Mark, OUTPUT Total |
| Diamond | Decision | A yes/no question, such as Mark >= 50?, with two exits |
| Rectangle with side bars | Subroutine | Calling a procedure or function defined elsewhere |
A loop in a flowchart
This flowchart adds up five marks. The decision checks whether five marks have been entered. If not, the No arrow loops back to input another mark.
- Start / end
- Process
- Input / output
- Decision
The same algorithm in pseudocode
Each shape becomes a line of pseudocode. The loop that repeats until a condition is true becomes REPEAT ... UNTIL.
DECLARE Total : INTEGER
DECLARE Count : INTEGER
DECLARE Mark : INTEGER
Total <- 0
Count <- 0
REPEAT
INPUT Mark
Total <- Total + Mark
Count <- Count + 1
UNTIL Count = 5
OUTPUT TotalExam tip. PseudoEditor's flowchart mode draws any program as a flowchart and turns your edits back into pseudocode. Press Run and it lights up each block as the program reaches it; see the flowchart mode lesson.
Key terms
- Terminator
- The flowchart symbol for START and STOP.
- Decision
- A diamond symbol with a yes/no question and two exits.
- Flow line
- An arrow showing the order of steps.
Check yourself
Which flowchart symbol is used for INPUT Age?Show answer
The parallelogram (input / output).
How many arrows leave a decision symbol?Show answer
Two: one for Yes and one for No.