Question: Write a program that simulates the rolling of two dice multiple times and uses a frequency array to count the distribution of the results of
Write a program that simulates the rolling of two dice multiple times and uses a frequency array to count the distribution of the results of the dice rolls. In function main declare a frequency array with the number of elements to cover all possible sums of the two dice (maximum sum will be 12). Also seed the random number generator. Call a function to determine the frequency of each sum over 400 rolls of the dice. From the frequency function you may call a separate function to determine the outcome of each dice roll. The dice roll function will use the random number generator to determine the value of each of the dice. It is not necessary, but is permissible, to use an array for the dice sums. Print the dice roll values and frequency of each in a table. Call a second function to make a histogram of the frequencies using rows of asterisks as shown in the attached example.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
