Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. When tossing one die, results of I through 6 are possible results. So when tossing a pair of dice, sums of 2 through 12

image text in transcribed
image text in transcribed
4. When tossing one die, results of I through 6 are possible results. So when tossing a pair of dice, sums of 2 through 12 are possible results. If the dice are fair, it can be shown that the probability of tossing each of these sums is. 2 or 12 2.8%: 3 or 11: 1 x 5.6%; 4 or 10 8.3%; 36 18 12 5 5 or 9 11.1%; 6 or 8: 13.9%; 7: 16.7% 9 36 6 Write a CH program that will repeatedly simulate tossing a fair pair of dice a number of times specified by the user (any number between 1 and 100,000), and calculate and display the total number of each sum produced along with its percentage of the total tosses (the relative frequency approximation of probability). . . Your program should be modular and must contain these functions: rollDie this function will receive an array and the number of tosses and will simulate tossing one die the specified number of times, storing the toss results in the array. findSum - this function will receive the number of tosses, two arrays holding the toss results for two dice, and a third array, and will calculate the toss sums, storing these in the third array toss Count - this function will receive the number of tosses, an array of toss sums, and an array of counters for the possible sums, and will examine the toss sums array and count the toss sum totals. display - this function will receive the number of tosses and an array of counters for the possible sums, and display the total number of tosses, and the total number of each of the possible sums, along with the probability of each possible sum. Your function main should repeatedly obtain a number of tosses from the user and then call the other functions to handle the simulations, until the user elects to exit the program. . Notes and suggestions: In 2012Die, use the rand function to simulate each die toss. Remember to include an appropriate call to stand in maan. . Notes and suggestions: In rolldie, use the rand function to simulate each die toss. Remember to include an appropriate call to srand in main Functions tossCount and display both receive an array of counters for the possible sums". As noted above, the toss sums will be values 2 through 12. So, use an integer array of size 13, with all elements initialized to 0, for the toss sums counter array. Then, to count a sum of value k (k between 2 and 12), increment element k of the toss sums,counter array. In display, the probability of a given sum is the percentage of tosses that produced that sum. In display, use the tab escape sequence \t to produce evenly spaced columns of numbers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions

Question

What is an Isolated System?

Answered: 1 week ago

Question

What is job enlargement ?

Answered: 1 week ago

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago