CSCI 261 - Programming Concepts (C++)Fall 2017 - Assignment 3 - Guess The NumberQuick Links: Canvas | CS @ Mines | Cloud9 | Piazza | zyBooks |
|||||||||||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | |||||||||||||||||||
This assignment is due
by Tuesday, September 26, 2017 11:59 PM.
This assignment exercises your ability
to use loops, and provides more experience with asking the computer to
generate a pseudo-random number.
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.
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 valid guesses
the player made.
Functional Requirements
Grading Rubric
Your submission will be graded according to the following rubric.
Submission
Always, always, ALWAYS update the
header comments at the top of your main.cpp file. And if you ever get
stuck, remember that there is LOTS of help
available.
From your Cloud9 workspace, right
click on the A3 folder in your workspace tree. Select "Download"
from the pop-up menu. This will download a file called A3.zip to your computer. It
contains all the files of your A3 folder (therefore Lab3A,
Lab3B, Lab3C, Lab3D, Assignment 3). Now in Canvas, go to Assignments > A3. Upload your
A3.zip file you just downloaded. And voila! Easy
peasy.
This assignment is due
by Tuesday, September 26, 2017 11:59 PM.
| |||||||||||||||||||
Last Updated: 09/28/17 12:34
|