Write a game program guess which tries to guess

Assignment Help Computer Engineering
Reference no: EM13322627

Write a game program guess which tries to guess what number you have chosen in as few guesses as possible. It can only ask you whether the number is less than some other number. The dialog on the console panel should look something like this:

Choose a number between 0 and 16.

Is it less than 8? y

Is it less than 4? n

Is it less than 6? n

Is it less than 7? n

Your number is 7.

The expected user inputs are y for "yes" and n for "no".

You will want to keep track of the range of numbers that might have been chosen based on the answers that have been given so far until there is only one number left. You can approximately divide an integer by 2 by right-shifting it by one bit.

*NOTE: the program is the one doing the guessing while the user is the one who inputs a number 0-16 for the computer to guess.

 

Reference no: EM13322627

Questions Cloud

Find period of vibration and max acceleration of cylinder : A 30 lb uniform cylinder can roll without sliding on a 15 degree incline. A belt is attached to the rim of the cylinder, and a spring holds the cylinder at rest. If the center of the cylinder is moved 2 in.
What is the resistance of the car : A toy car is driven by a battery of 9V. it draws a current of 2mA. what is the resistance of the car
Write mips assembly language program to recursively compute : Write a MIPS assembly language program to recursively compute the nth term of Perrin's sequence. n will be input from the keyboard.
Define what is the initial pressure of h2s in the flask : An empty 5.00- flask is charged with 0.450g of pure H2S(g) , at 25 degrees celsius What is the initial pressure of H2S(g) in the flask
Write a game program guess which tries to guess : You will want to keep track of the range of numbers that might have been chosen based on the answers that have been given so far until there is only one number left. You can approximately divide an integer by 2 by right-shifting it by one bit.
What is the wavelength of the light in air : A glass sheet measuring 10cm X 25cm is covered by a very thin opaque coating. In the middle of this sheet is a thin, What is the wavelength of the light in air
What is the chlorine concentration when the tank is put back : A water tower containing 4000 m3 of water has been taken out of service to install a chlorine monitor. The concentration of chlorine in the water tower was 2.0 mg/L when the tower was taken out of service.
Benefits of enterprise agreements : Outline and analyse the nature, methods and benefits of enterprise agreements in enhancing workplace productivity.
Determine a sorption coefficient for the soil at the site : Chromium contamination is a problem at a number of hazardous-waste sites. At one site local concentrations of chromium reached 60,000 mg chromium/kg soil and 19,000 mg/L chromium in the water.

Reviews

Write a Review

Computer Engineering Questions & Answers

  The acme corporation is looking to rapidly advance

This solution provides the learner with an understanding of how best to accomplish the task. This solution is comprised of over 2000 words of text with 4 references.

  How to set up or recover cybersecurity

How to set up or recover cybersecurity.

  Utilizing the rsa protocol encrypt and decrypt messages

You are asked to hand-turn the RSA protocol in order to encrypt and decrypt the messages (utilizing smaller numbers than are used in the practice, so that calculations may be done through the hand).

  What is the role of statistical analysis in simulation

How do pseudo-random numbers affect an accuracy of a simulation.

  Recommend a removable storage backup

Managers want to be able to print schedules on any printer at any restaurant if traveling and in a motel with a laptop. Please explain what you would have to do to allow managers to do this and how they will reference the printer.

  Bookstore information management system

State the possible objects in bookstore operation involving their attributes and methods.Recognize the possible use cases and actors.

  Include the declaration in a program

Write down a declaration to store the string "This is a sample" in an array named samtest. Include the declaration in a program that displays the values in samtest in a for loop that uses a pointer to access each element in the array.

  Design an application that declares a purchase object

as you prompt for a sale amount, do not proceed until the user has entered a nonnegative value. After a valid urchase object has been created, display the objects invice number, sale amount, and sales tax.

  Make draft or a excel spreadsheet of java vs. c++

want a draft or a excel spreadsheet of Java vs. C++ and its comparisons. I want bold statements and strong related bold information.

  Find out if the graph is connected

show both graphs, then I need to display which portions of the 2 graphs are "connected" or the same. The areas that are the same need to be put into a minimal spanning tree.

  Developing the lan network for a company

You have been asked to develop a LAN with operation over the distance of around 100m. Compare and contrast the twisted pair cable, fiber-optics, and wireless for this application.

  Assume the network is a packet-switched datagram network

discuss sending a file of F bytes over a path of Q links. Each link transmits at R bps. The network is lightly loaded so that there are no queuing delays. Propagation delay on each link is Tp on average.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd