06.05.17 - 07.30.17
Program compiles and runs with no errors or warnings | 10 pts |
Program allows input of sides and provides correct error checking of the input | 15 pts |
Program correctly calculates and displays the possible totals | 25 pts |
Program correctly calculates and displays the calculated odds for each total | 25 pts |
Program correctly calculates and displays the actual roll total percentages | 25 pts |
Total | 100 pts |
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.
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.
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.
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.
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.