Question: Create a class that manages a dice matching game. There are 3 dice randomly being rolled. Create a default constructor that randomly assigns values

Create a class that manages a dice matching game. There are 3 dice randomly being rolled. Create a default

Create a class that manages a dice matching game. There are 3 dice randomly being rolled. Create a default constructor that randomly assigns values to the dice(1-6), and a deconstructor that prints when the object is being destroyed. Create functions that display the dice, and allows the user to reroll one of the dice. Additionally check to see how many of the dice match. For this lab you must dynamically allocate an instance of the classes using only smart pointers. The object will be managed by using two shared pointers. The shared pointers will be tested to see if they point to an object then reset() and then display the number of shared objects in its grouping. Please refer to the example output on the back. Useful Code: #include srand(time(0)); rollADie = rand() % 6 + 1; Dice #1 is 3 Dice #2 is 3 Dice #3 is 3 all three dice are equal //seed the timer to reset // generate number in the range of 1 - 6 Sample Cases To Consider Dice #1 is 2 Dice #2 is 2 Dice #3 is 5 two dice are equal Dice #1 is 3 Dice #2 is 6 Dice #3 is 4 no dice are equal

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

include include include include class DiceGame private int dice public DiceGame dice new int3 s... View full answer

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 Algorithms Questions!