Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions