The Five Steps
Do a small example by hand
We can try a small hand example.
- We pick a random number between 1 and 100, say the number is 49.
- We prompt the player to enter a guess, say they enter 12.
- This is their first guess.
- 12 is less than 49, so we hint their guess is too low.
- We prompt again for a guess, say they enter 35.
This is their second guess.
- 35 is still less than 49, so we hint their guess is too low again.
- We prompt again for a guess, say they enter 99.
This is their third guess.
- 99 is greater than 49, so we hint their guess is too high.
- We continue like that until the player either guesses the
number, or they run out of guesses - i.e. get the number wrong
on the 6th try. We then tell the player they win or lose.
Translate the algorithm into a programming language (like C)
Test the program
to Overview.