Question: Roll two dice one red and one blue 1 0 0 0 times each. As you roll the dice you will need to keep track
Roll two dice one red and one blue times each. As you roll the dice you will need to keep track of how many times each number appears for both dice storing the information in an array fro each die After you have rolled the blue die and the red die times each you will need to display to the screen the frequency of each number on the blue die and then the red die. Your output should look similar to this:
The result of rolling dice times each is:
Blue Dice
Red Dice
rolled times rolled times
rolled times rolled times
rolled times rolled times
rolled times rolled times
rolled times rolled times
rolled times rolled times
For this assignment you will need to include the cstdlib header file. This will allow you to access the predefined functions rand & srand These two functions will allow you to randomly generate numbers.
You should have the following functuions:
void rollDieint dieSIZE; rolls a die times and fills array
void displayconst int redSIZE const int blueSIZE; displays the contents of the
larrays in a table as shown above
void initializeinty dieSIZEinitializes the array to zeros
I would also assume that in maing you would have Darrays defined such as redDieSIZE and blueDieSIZE Where SIZE is a global conatant of representing the siz sides of a standard die.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
