Question: C programming lab OVERVIEW For this lab you will create a C program that will display all of the possible totals that can be rolled
C programming lab
OVERVIEW
For this lab you will create a C program that will display all of the possible totals that can be rolled using two dice of a specified number of sides, the odds of rolling each of those totals, the actual percentage of time that each total was rolled after 36,000 attempts.
INPUTS
For this lab the dice that are rolled will have a number of sides specified by the user. Prompt the user for the number of sides for this dice and accept any integer value between 2 and 100 inclusively.
PROCESSING
With the number of sides from the user determine all of the possible totals that can be rolled using two dice with that number of sides. For example, two 6 sided dice could produce totals between 2 and 12.
Next, calculate the odds of rolling each of those totals as a percentage. Dice should not actually be rolled to find these odds.
Finally, roll two simulated dice 36,000 times and track how often each total is actually rolled. Calculate the actual percentage of each total for later display.
We can simulate rolling dice in C by using a random number generator, see attached program for an example of doing this.
OUTPUT
The program should produce 3 columns of output, see attached file for an example. The possible totals should be displayed to the user as a first column of output, the calculated odds of rolling each total should be displayed as a second column of output, and the actual percentage of times each total was rolled should be shown as the third column of output.
SUMMARY
If C's random number generator is producing good pseudo-random numbers there should be a strong similarity between the calculated odds of rolling each total and the actual number of times each total was rolled.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
