Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ code to create a game. Your goal for this assignment is to exercise your knowledge of selection statements ( if / else ), looping

C++ code to create a game.

Your goal for this assignment is to exercise your knowledge of selection statements ( if / else ), looping constructs ( while and for ) and the use of rand(). Your game must adhere to the following interaction example.image text in transcribedimage text in transcribed

Instructions Your goal for this assignment is to exercise your knowledge of selection statements (if else), looping constructs (while and for) and the use of rand(). Your game must adhere to the following interaction example. Hold onto your pants, we're about to play guess-the-numbah! Pick a number between 0 and 100: 20 Too low! Not even close! Pick a number between 0 and 100: 75 Too high! Pick a number between 0 and 100: 63 Too low! Oooh you're close! Pick a number between 0 and 100: 64 That's right! You won the game in 4 tries Your game must use a random number between 0 and 100, inclusively. You should only accept guesses that are within the range [0, 100], showing an error message otherwise. Your game must print "Too low!" or Too high!" relative to the target number and the players' guess. Your game must print "Oooh you're close!" if the number guessed differs from the target by 5 or less, and it must print "Not even close!" if the number guessed differs from the target by a value of 25 or more

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago

Question

5. Our efficiency focus eliminates free time for fresh thinking.

Answered: 1 week ago