CS 160 - Programming Concepts and ApplicationsSummer II 2018 - A5 - The Power of Vectors!Quick Links: Canvas | John Cabot | Piazza | zyBooks |
|||||||||||||||||
| Home | Contact | Syllabus | Assignments | Schedule | Resources | | |||||||||||||||||
This assignment is due by Thursday, July 19, 2018 11:59 PM. · Instructions · Rubric · Submission · Part I - Working With Vectors
This assignment will make Lab5B more flexible.
Instead of requiring the user to enter 15 numbers every time, we will
allow the user to enter as many numbers as they wish (assume they will
enter at least 1 number). The user will enter non-negative numbers
(greater than or equal to zero) one at a time. When the user wishes to
no longer enter numbers, the user should enter -1 to signal they are
done.
Hey! Witness my first vector mojo!
Enter as many non-negative numbers as you'd like and I will tell you what they are. When you wish to be done, enter -1 to stop entering numbers. Your Number Is: 8 Your Number Is: 6 Your Number Is: 7 Your Number Is: 9 Your Number Is: 3 Your Number Is: 2 Your Number Is: 4 Your Number Is: -1 So awesome! You entered 7 numbers. The numbers are: 8 6 7 9 3 2 4 Have a nice day! The smallest number is: 2 The largest number is: 9 The first number is: 8 The last number is: 4 Gaze at my awesome. A second interaction may look like:
Hey! Witness my first vector mojo!
Enter as many non-negative numbers as you'd like and I will tell you what they are. When you wish to be done, enter -1 to stop entering numbers. Your Number Is: 8 Your Number Is: 6 Your Number Is: 7 Your Number Is: 9 Your Number Is: -1 So awesome! You entered 4 numbers. The numbers are: 8 6 7 9 Have a nice day! The smallest number is: 6 The largest number is: 9 The first number is: 8 The last number is: 9 Gaze at my awesome. Part II - Sorting the Vector
Now print the values entered by the user in ascending order. Create a function called
Hey! Witness my first vector mojo!
Enter as many non-negative numbers as you'd like and I will tell you what they are. When you wish to be done, enter -1 to stop entering numbers. Your Number Is: 8 Your Number Is: 6 Your Number Is: 7 Your Number Is: 9 Your Number Is: 3 Your Number Is: 2 Your Number Is: 4 Your Number Is: -1 So awesome! You entered 7 numbers. The numbers are: 8 6 7 9 3 2 4 Have a nice day! The smallest number is: 2 The largest number is: 9 The first number is: 8 The last number is: 4 The numbers sorted are: 2 3 4 6 7 8 9 Gaze at my awesome. Part III - Search for a Value
Finally, ask the user to enter a number to check if it was previously entered. The user should be able to enter as
many numbers as they wish, again using -1 to signify they are done. Use the following output as a guide
for the desired interaction. Create a function called
Hey! Witness my first vector mojo!
Enter as many non-negative numbers as you'd like and I will tell you what they are. When you wish to be done, enter -1 to stop entering numbers. Your Number Is: 8 Your Number Is: 6 Your Number Is: 7 Your Number Is: 9 Your Number Is: 3 Your Number Is: 2 Your Number Is: 4 Your Number Is: -1 So awesome! You entered 7 numbers. The numbers are: 8 6 7 9 3 2 4 Have a nice day! The smallest number is: 2 The largest number is: 9 The first number is: 8 The last number is: 4 The numbers sorted are: 2 3 4 6 7 8 9 Enter a number to check if you previously entered it: 4 Yes you did! Enter a number to check if you previously entered it: 62 No, sorry you didn't. Enter a number to check if you previously entered it: -1 Gaze at my awesome. Functional Requirements
Grading RubricYour submission will be graded according to the following rubric.
This assignment is due by Thursday, July 19, 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
"Set5" folder
and only the "Set5" 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, July 19, 2018 11:59 PM. | |||||||||||||||||
Last Updated: 07/05/18 16:23
|