Dice Rolling Program help
I can't seem to get this program down right and it's due by midnight tonight. If anyone could help me out with this code, it would be much appreciated. Here's the assignment:
This project is designed to give you experience working with arrays and passing arrays to functions.
The program you write will simulate the rolling of a pair of dice for as many times as the user wishes, up to 30,000 times. You will keep track of how many times a particular value is rolled, by having an array of counters. The possible values will be 2 through 12. The value 2, aka snake eyes, can only be produced when each of the two dice have come up 1's. Likewise, the value 12, aka boxcars, can only be produced when each of the two dice have come up with the value 6.
The other values (the values between 3 and 11) will tend to occur more often than either the snake eyes or the boxcars, because there is more than one roll possible to create those values. The 3 could be gotten by die #1 rolling a 1, and die #2 rolling a 2 OR by die #1 rolling a 2 and die #2 rolling a 1. So theoretically, it is twice as likely that a 3 will be rolled, rather than a 2 or a 12. Other values rolled will exhibit other probabilities.
The basic project is to simply simulate the rolling of two dice and count how many times each of the possible values was rolled. The counts are to be stored in an array. After all of the rolling is complete, print out the value and the number of times it was rolled. DO NOT ATTEMPT TO STORE THE INDIVIDUAL VALUES ROLLED IN AN ARRAY. Your book can really help you out with this project, since it gives an example of a similar program. You are rolling two dice, rather than one...AND...you MUST have at least one function that takes the array as an argument. I would suggest PrintCounts as a logical choice of such a function.
You should do most of your work in functions. I would suggest that you write a function called RollDice, which would return the result of rolling 2 dice. (The sum of two individual die rolls). You should also have a function that will print out the number of rolls that occurred for each possible value. You may have other functions if you like. Your output should be formatted so that the values and number of occurrences line up in columns as shown below.