| .
|
Looping guessing game
Write programs that loop
----------------------------------------
Lab #20.1: Guess the Secret Number
----------------------------------------
Using the slide example as a guideline,
write a program that asks the person running the program
to guess a randomly assigned secret number.
Report if the guess is correct or too high or too low.
Use a loop so that the program does not end until
they guess the secret number.
----------------------------------------
Lab #20.2: Report the average number of guesses
----------------------------------------
Modify the above program so that the program reports
the total number of guesses. Once this is done,
modify the program so that it plays the game 10 times
and reports the average number of guesses.
|