Flow Charts & Pseudocode
Flowchart Symbols
A flowchart is a diagram of an algorithm. It should show the order of steps, where input and output occur, where decisions branch, and where loops return.
Terminator
Use once at the beginning and once at the end. Label these Start and End.
Process
Use for calculations, assignments and actions the program performs.
Input / Output
Use when the program receives data or displays information to the user.
Decision
Use a question with two labelled exits, normally Yes and No.
Flow Line
Use arrow direction to show the next step. Every symbol should be connected logically.
Connector
Use sparingly to avoid crossed lines or continue a large flowchart on the same page.
Correct Example: Selection
This flowchart checks whether a mark is a pass. Notice the decision diamond is written as a question and both outgoing branches are labelled.
Correct Example: Iteration
A loop must show the path that repeats. This example keeps asking for a password until it is correct or the user has tried three times.
Accuracy Checklist
Do
- Use a terminator for Start and End.
- Use parallelograms only for INPUT and OUTPUT.
- Write decision diamonds as questions.
- Label decision branches, usually Yes and No.
- Show the loop-back arrow when a step repeats.
Don't
- Put calculations inside input/output symbols.
- Leave decision arrows unlabelled.
- Let arrows float without touching symbols.
- Use a decision diamond for an action such as calculating a total.
- Draw a loop as a straight line with no return path.
Pseudocode
A plain-language description of code logic. Not a real programming language.
Conventions
- Use ← for assignment (not =)
- Keywords in UPPERCASE: IF, THEN, ELSE, FOR, WHILE, ENDFOR, etc.
- Indent to show structure
- Use meaningful variable names
Example: Calculate Average
BEGIN CalculateAverage
total ← 0
count ← 0
INPUT number
WHILE number ≠ -1
total ← total + number
count ← count + 1
INPUT number
ENDWHILE
IF count > 0 THEN
average ← total / count
OUTPUT "Average is: " + average
ELSE
OUTPUT "No numbers entered"
ENDIF
END CalculateAverage