
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Here are the first three lines as they should be printed:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
and so on, until 1000.
(a) On the first guess, if the user is right, print “You Win” and exit the program; if the user is wrong, print “Try Again” and the program continues. (b) On subsequent guesses, if the user is right, print “You Win” and exit the program: if the user is wrong, print “Hotter” if the current guess is closer to the hidden number than the previous guess, “Colder” if the guess if farther, and “Try ”Again” if it is the same distance.
Here is an example, where the hidden number is 13:
Guess the hidden number.
19 Try Again 2 Colder 10 Warmer 15 Colder 13 You Win