Most programs on your computer have been written using a programming language of some sort, for example in C#, Python, Java, Visual Basic…
Before a programmer jumps in and begins coding a program, they usually need to plan how this program is going to work. To do this, they will use pseudo code to write out a ‘plan’ of their program – usually in the form of an algorithm.
Now, pseudo code is not technically a programming language, but it does use certain command words to help a user know how the program is running; here are a few keywords that BBC Bitesize recommend you might use in your pseudo code…
Let’s have a look at writing a simple program in pseudo code.
Write a program that will ask a user to enter two numbers, add them together and display the outcome.
First of all, we need to ask a user to enter two numbers…
INPUT firstNumber INPUT secondNumber
Once we have entered our two numbers, we need to add them together
total = firstNumber + secondNumber
And finally, we need to output the result…
So altogether, our pseudo code would look like…
INPUT firstNumber INPUT secondNumber total = firstNumber + secondNumber OUTPUT total
Some exam questions may be a bit trickier to answer than this, however if you remember all computer systems follow the basic structure
INPUT – PROCESS – OUTPUT
So each algorithm should have:
- Something going in, whether that is an input or variable
- A process of some kind, possibly arithmetic or logic
- Something coming out, whether that is displayed to the user or stored in a variable
Have a go at some of the OCR algorithm challenges and see how you get on, it’s a good idea to practice these often because it takes some time to master!