Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete program in C + + that figures out the user's number using exactly four yes or no questions. The program will first

Write a complete program in C++that figures out the user's number using exactly four yes or no questions. The program will first tell the user to think of an even number between 2 and 32 inclusive, then after asking the four questions, the program will announce the user's number. Here is a sample runs to show what the questions might look like and how the final answer should be announced. You are free to change the questions as long as they are still yes/no questions and the program never needs more than four yes or no answers to reliably determine the user's number. Notice the user can enter their yes as 'y' or 'Y' and their no as 'n' or 'N'. The program should accept both uppercase and lower case answers.
Please think of an even number between 2 and 32(inclusive).
Is your number bigger than 16? y
Is your number bigger than 24? N
Is your number bigger than 20? Y
Is your number bigger than 22? n
Your number is 22.
Also no variables of any type other than int and char. No loops, no function calls please.

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

Students also viewed these Databases questions

Question

What is focal length? Explain with a diagram and give an example.

Answered: 1 week ago

Question

What is physics and how does it apply in daily life?

Answered: 1 week ago

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago

Question

Prepare a constructive performance appraisal.

Answered: 1 week ago

Question

List the advantages of correct report formatting.

Answered: 1 week ago