Question: Write a C++ program that plays a number guessing game with the user. The user thinks of a number then answers a series of questions

Write a C++ program that plays a number guessing game with the user. The user thinks of a number then answers a series of questions asked by the computer until it correctly guesses the number. For example, if the users number is 10, a typical sample run will look like this:

Think of a number between 1-50.

Is the number 25? no

Is the number less than 25? yes

Is the number 12? no

Is the number less than 12? yes

Is the number 6 ? no

Is the number less than 6 ? no

Is the number 9 ? no

Is the number less than 9 ? no

Is the number 10? yes

I have succeeded in guessing the number.

Write it so the computer can solve it with the minimum number of questions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!