Question: Task 1 Write a program that generates a random number in the range of 0 ~ 100 and asks the user to guess what the

Task 1 Write a program that generates a random number in the range of 0 ~ 100 and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display Too high, try again.. If the user's guess is lower than the random number, the program should display Too low, try again. When the user correctly guesses the random number, the program should display the number of guesses. The program should use a loop that repeats until the user correctly guesses the random number. An Example of Test Runs csci2>a.out a number between 0 Let's start this game. Please guess 100. your guess? 40 Too high, try again. your guess? 30 Too high, try again. your guess? 20 Too low, try again. your guess? 25 Too high, try again. your guess? 23 Too low, try again. your guess? 24 You got it! The answer is 24. The number of times you tried is 6. Thanks for playing this game. Other requirements Insert comments in the program so that it can be read easily. You can follow examples on
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
