Problem: The guessing game

There is a guessing game children are fond of in which one player chooses a number between 1 and 100 and the other player must guess it. The only feedback given the guesser is whether their most recent guess was too high or too low. The game ends when the number has been guessed. If a long car ride is involved then the players might keep track of how many guesses they have taken over a number of games.

Write a program that 'plays' this game by picking a number and then accepting guesses about the number's value. After each guess it should inform the user if the guess was too high or too low. The game should end when the number is guessed, at which point the computer should display the number of guesses taken.