Question: 1. Write a C++ program that simulates the rolling of two dice. The program should call rand to roll the first dice, and should call

1. Write a C++ program that simulates the rolling of two dice. The program should call rand to roll the first dice, and should call rand again to roll the second dice. The sum of the two values should then be calculated. [Note: Because each dice has an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12 with 7 being the most frequent sum and 2 and 12 being the least frequent sums. The figure below shows the 36 possible combinations of the two dice. Your program should roll the two dice 40,000 times. Use a single-subscripted array to tally the numbers of times each sum appears. Print the results in a tabular format. Also, determine if the totals are reasonable, ( i.e, there are six ways to roll a 7), so approximately 1/6 of all the rolls should be a 7. (40 Points)

Dice Combination table

Columns: Dice A

Rows: Dice B

1 2 3 3 5 6
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 5 6 7 8 9
4 5 6 7 8 9 10
5 6 7 8 9 10 11
6 7 8 9 10 11 12

Output file

Output file Sum

Total.

Expected.

Actual.

2

1000

2.778%

2.778%

3

1958

5.556%

5.439%

4

3048

8.333%

8.467%

5

3979

11.111%

11.053%

6

5007

13.889%

13.908%

7

6087

16.667%

16.908%

8

4996

13.889%

13.878%

9

3971

11.111%

11.031%

10

2996

8.333%

8.322%

11

2008

5.556%

5.578%

12

950

2.778%

2.639%

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!