CSCI 261 - Programming Concepts (C++)Summer 2018 - A4 - Guess The NumberQuick Links: Canvas | CS @ Mines | Piazza | zyBooks |
|||||||||||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | |||||||||||||||||||
This assignment is due by Thursday, May 24, 2018, 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 RubricYour submission will be graded according to the following rubric.
This assignment is due by Thursday, May 24, 2018, 11:59 PM. SubmissionAlways, 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. The following instructions are copied from How to Submit Homework. It is critical that you follow these steps when submitting homework.
If you do not follow these instructions, your assignment
will receive a major deduction. Why all the fuss? Because we have
several hundred of these assignments to grade, and we use
computer tools to automate as much of the process as possible.
If you deviate from these instructions, our grading tools will
not work. And that makes us very unhappy. And when we're
unhappy, we give penalties. Thus, make us happy.
Submission Instructions Here are step-by-step instructions for submitting your homework properly:
In summary, you must zip the
"Set4" folder
and only the "Set4" folder, this zip folder must have several sub-folders, you must name all these folders correctly, you must submit the correct zip file for this
homework, and you must click the "Submit" button. Not doing these steps is like bringing your
homework to class but forgetting to hand it in. No concessions will be made for
incorrectly submitted work. If you incorrectly submit your homework, we will not be able to
give you full credit. And that makes us unhappy. This assignment is due by Thursday, May 24, 2018, 11:59 PM. | |||||||||||||||||||
Last Updated: 05/15/18 20:41
|