The Five Steps

Understand the problem

What is this program supposed to do?
The problem statement is pretty clear. The program should play this guessing game.
What kind of information is it given? (What is the input?)
The input is the set of player guesses, one at a time, until the player either gets the number, or runs out of guesses.
What kind of results is it to produce? (What is the output?)
The output is a hint after each wrong guess telling the player if their guess is too high or too low.
What formulas or techniques will be needed?
Most of the operation of the game is straightforward - we compare the player's guess with the stored number. One tricky thing we will have to worry about is generating the random number.

Do a small example by hand

Write an algorithm for solving the problem

Translate the algorithm into a programming language (like C)

Test the program


[up] to Overview.