Question: c++ Write a program that simulates the rolling of two dice. The sum of the two values should then be calculated (range: 2-12). Your program

c++

Write a program that simulates the rolling of two dice. The sum of the two values should then be calculated (range: 2-12). Your program should roll the dice 36,000,000 times (thats 36 million!). Use a one-dimensional array called rolls to tally the numbers using the sum as the index to the array element. In other words if you roll a 2 and a 3, add 1 to rolls [5]. Print the results in a table format. Note that positions 0 and 1 in the array are not used. Which combination occurred the most times? the least times?

NOTES:

int rolls[36000000] = {0}; // defines and initializes the array elements to 0

srand(time(0)); // seed the randomizer, #include to seed the randomizer

int die1 = rand() % 6 + 1; // returns a random number 1-6

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!