Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part II. Project (20 pts) -- A Guessing Game (submit before the due date next week) Objective: To review C++ basic programming knowledge: data types,

Part II. Project (20 pts) -- A Guessing Game (submit before the due date next week)

Objective: To review C++ basic programming knowledge: data types, writing loops, writing functions, using C++ I/O, using the standard library,.

To gain experience with the program development life cycle, especially specification, design, coding, and testing

Project Description:

In this warm-up project, you are to write a C++ program LabProj1.cpp that lets the user or the computer play a guessing game. The computer randomly picks a number between 100 and 200 inclusively, and then for each guess the user or computer makes, the computer informs the user whether the guess was too high or too low. The program should end when selected the correct number.

Here is a sample run of the program (please paste your sample run like this as a comment at the end of your source codes):

Would you like to (p)play or watch the (c)computer play?

p

Enter your guess between 100 and 200.

150

Sorry, your guess is too low, try again.

Enter your guess between 100 and 200.

175

Sorry, your guess is too low, try again.

Enter your guess between 100 and 200.

188

Sorry, your guess is too high, try again.

Enter your guess between 100 and 200.

181

Congrats, you guessed the correct number, 181.

Would you like to (p)play or watch the (c)computer play or (q)quit?

c

The computer's guess is 150

Sorry, your guess is too low, try again.

The computer's guess is 175

Sorry, your guess is too low, try again.

The computer's guess is 187

Sorry, your guess is too low, try again.

The computer's guess is 193

Sorry, your guess is too high, try again.

The computer's guess is 190

Sorry, your guess is too low, try again.

The computer's guess is 191

Sorry, your guess is too low, try again.

The computer's guess is 192

Congrats, you guessed the correct number, 192.

Would you like to (p)play or watch the (c)computer play or (q)quit?

q

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_2

Step: 3

blur-text-image_3

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 Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Compute 3 - (2 + 4)3 (4 + 3)2 in Z5.

Answered: 1 week ago

Question

=+What about SRI funds? Why, or why not?

Answered: 1 week ago