Pseudo-code
An algorithm is a sequence of instructions used to solve a problem.

There are three main methods of defining algorithms:

  • pseudo-code
  • flowchart
  • structured English

 

 
  Pseudo-code

An algorithm written in English showing the structure, but ignoring the strict rules of programming language syntax.

Example :

INPUT(CardNumber)
REPEAT
   INPUT(PIN)
   IF PIN is incorrect THEN
      output("Wrong PIN")
   END IF
UNTIL PIN is correct
INPUT(Amount)
IF customer has enough funds THEN
   dispense cash
   update customer's balance
ELSE
   OUTPUT("Not enough funds")
END IF

Note the constructs are included (REPEAT loop and IF..THEN..ELSE block), but not the program language syntax.

Structure is shown by indenting blocks of statements.

 

 
 

Structured English - This would be a description of the process in English. The structure of the program must be indicated however.