Uploaded by Hieu Le

COMP-1431 Asgmt #1

Assignment #1
Upload your source code files ONLY in .cpp or .h format.
Avoid copying/pasting your code into a text file or other file formats.
Limit <include> statements to those contained in the C++ standard library. Any
headers that you create and include in your code must be a part of your submission.
Double-check that your code compiles before submitting. You will lose points for
compilation error even if your logic is correct.
Q1. Write a program that simulates the rolling of two dice. The sum of the two values
should then be calculated. Your program should roll the two dice 36,000,000 times. Use a
one-dimensional array to tally the numbers of times each possible sum appears and print
it. Also, determine if the totals are reasonable (i.e., there are six ways to roll a 7, so
approximately one-sixth of all the rolls should be 7).
[Hint: what is the minimum and maximum sum obtained when you roll a die? Some sums
are more frequent than the others.] (10 Points)
Q2. Use a vector to read 10 integer numbers, each of which is between 1 and 50. Begin with
an empty vector and use its push_back function to add each unique value to the vector. As
each number is read, validate it and store it in the array only if it is not a duplicate of a
number already read. After reading all the values, display only the unique values that the
user entered. (10 Points)