# C++ Programming Help (Loops)--Big Question

Sep 19th, 2015
Sigchi4life
Category:
Computer Science
Price: \$40 USD

Question description

This is a big question I need help with. Please follow these instructions very carefully. This is a beginner C++ class, so I'd rather not have very complex stuff in there. Please ask me if you have questions on anything, I'm pretty quick to answer. Thanks !

-----------

### 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.

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 [0100], 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 2 or less; and it must print "Not even close!" if the number guessed differs from the target by a value of 20 or more.

For example, if the target is 50 and the player enters 10, your program should print "Too low!" and "Not even close!", but if the player enters 52, your program should print "Too high!" and "Oooh you're close!". When the correct number is guessed, your program must print "You won the game in N tries" where N is the number of guesses the player made.

### Hints

• Define appropriate constants for the LOW (=0) and HIGH (=100) limits of the game.
• Also, define appropriate constants for the TOO_CLOSE_DIFFERENCE (=2) and TOO_HIGH_DIFFERENCE (=20) values.
• As a reminder, typically code that validates user input uses the do-while statement.
• Define a variable to count the number of valid guesses.

(Top Tutor) Daniel C.
(997)
School: UT Austin

Studypool has helped 1,244,100 students

## 8 Reviews

Summary
Quality
Communication
On Time
Value
darnay
Nov 29th, 2016
" The best tutor out there!!!! "
dontuwannaknow
Nov 20th, 2016
" Excellent work as always thanks so much "
SjSurvivor143
Nov 6th, 2016
" Thanks for the help. "
ddg82
Oct 28th, 2016
" Thanks, good work "
tinytim47
Oct 15th, 2016
" Wow this is really good.... didn't expect it. Sweet!!!! "
jestin7
Oct 6th, 2016
" This tutor is great! "
mixedballz
Oct 1st, 2016
" excellent work as always thanks for the help "
lilmoe415
Sep 22nd, 2016
" Thank you, Thank you, for top quality work, this is your guy!! "

1826 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors