Question: Please use C++ for the code Write a program that will prompt the user to input the following: 1. The number of dice to be

Please use C++ for the code

Please use C++ for the code Write a program that will prompt

Write a program that will prompt the user to input the following: 1. The number of dice to be rolled. 2. How many times the dice should be rolled? Since the values above will vary, you must use pointer arrays and dynamically allocate memory. Example 1. The user entered 3 dice and rolled them twice. 1st Roll: Total of Faces: 12 2nd Roll: Total of Faces: 8 The program will store the total of faces per roll and the values will be later used to plot a graph. The graph should look like the output shown below. 3: 4: 5: 6: 7: 8:* 9: 10: 11: 12: * 13: 14: 15: 16: 17: 18: The asterisk (*) tallies the number of times that total has occurred. 3 and 18 are the minimum and maximum totals, respectively, for rolling 3 dice. Example 2. For larger data sets, the user entered 5 dice and rolled them 500 times. The graph should look like the output shown below. 5: 6:** 7: * 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: *** 27: 28: ** 29: 30: ********** and 30 are the minimum and The asterisk (*) tallies the number of times that total has occurred. maximum totals, respectively, for rolling 5 dice. The declaration and implementation sections of the class have been defined for you. Use it to complete your program. #include #include #include #include #include using namespace std; struct Die { int num; Die(); Die(); void roll(); const int getNum(); }; Die::Die { num = 1; } Die! :-Die() { //Destroy the object. } void Die::roll) { num = rand() % 6 + 1; //Randomly generates a number from 1 to 6. } const int Die::getNum() { return num; } 2. CH Source Code Grading Criteria 30 Utilized all of the attributes and member functions of the class. 20 Used pointer arrays and dynamic memory allocation. 20 Used a function/module to plot the graph (can be a class member or not). 20 Passed arguments to parameters. 10 The plotted graph is in shape of a bell curve. 100 When you are ready to submit, use the suggested values below for your final output. 6 Number of dice: Number of times to roll dice: 1000 Submit your source code and a screenshot of your final output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!