Question: Chapter 3 Write a program that uses a function that returns a number between 1 and 6 . Use this function to simulate the roll

Chapter 3 Write a program that uses a function that returns a number between 1 and 6. Use this function to simulate the roll of a die. Allow the user to specify the number of trials and then tabulate that number of rolls of two dice. The program must allow for repeated simulations. Initialize rand() using srand() and time(). Possible Outcomes for any roll111213141516212223242526313233343536414243444546515253545556616263646566 Possible Totals 234567345678456789567891067891011789101112 Therefore, for example, the odds of a 7 are 6:36 in any given roll. If you roll 36 times then the expected outcome for a 7 is 6. So odds are that you will get a 7,6 times. The odds you will get a 2 are 1. Tabulate the difference between the expected outcome (odds) and the random number generator outcome list this as error. In general, you should notice a decrease in error with more trials. Example Output: This program rolls two dice and tabulates the results. Please enter the number of rolls you want: 36 Sum #Rolled Odds %Error 2: 01100.00003: 1250.00004: 1366.66675: 7475.00006: 6520.00007: 5616.66678: 2560.00009: 94125.000010: 63100.000011: 02100.000012: 01100.0000Try again? (1= Yes, 0= Exit)1Please enter the number of rolls you want: 360 Sum #Rolled Odds %Error 2: 51050.00003: 19205.00004: 243020.00005: 40400.00006: 645028.00007: 546010.00008: 625024.00009: 324020.000010: 343013.333311: 172015.000012: 10100.0000Try again? (1= Yes, 0= Exit)1Please enter the number of rolls you want: 36000 Sum #Rolled Odds %Error 2: 100710000.70003: 203720001.85004: 301530000.50005: 397040000.75006: 496450000.72007: 603060000.50008: 497750000.46009: 395940001.025010: 304130001.366711: 200820000.400012: 99310000.7000Try again? (1= Yes, 0= Exit)1Please enter the number of rolls you want: 36000000 Sum #Rolled Odds %Error 2: 100080910000000.08093: 200294320000000.14724: 300337730000000.11265: 399814840000000.04636: 499832250000000.03367: 599948660000000.00868: 499901750000000.01979: 399721440000000.069710: 300127630000000.042511: 199891820000000.054112: 100049110000000.0491Try again? (1= Yes, 0= Exit)1Please enter the number of rolls you want: 360000000 Sum #Rolled Odds %Error 2: 10008663100000000.08663: 19995846200000000.02084: 30002587300000000

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