Question: This program should be written in Visual Studios c++. This program should ask the user how many die rolls to simulate. Your program should support

This program should be written in Visual Studios c++. This program should ask the user how many die rolls to simulate. Your program should support from 1 to at least 100,000 simulated rolls. Once the user has entered the number of die rolls to simulate, your program should use repeated calls to C's rand() function (along with proper scaling and shifting) to simulate the proper number of rolls of a single six-sided die. After the rolls have been simulated, your program should print out some statistics about the rolls. This should include:

1.Total number of rolls simulated.

2.Number of times each number was rolled.

3.Percentage of the time each number was rolled, as a percentage of the total number of rolls.

4.Average value of rolls (i.e., sum of the value of all rolls divided by the total number of rolls).

5.Standard deviation of rolls (i.e., square root of average of squared differences from the mean).

Requirements:

1.All die rolls should be stored in an array (remember you'll need an array of at least size 100,000 since the program should be able to handle at least 100,000 rolls).

2.The array which holds the die rolls should be declared inside of main().

3. The code which actually simulates the die rolls should be in its own function, and not part of main. You'll have to pass the array of rolls and the number of rolls into this function.

4.The code which prints out the statistics about the rolls should be in its own function, and not part of main. You'll have to pass the array of rolls and the number of rolls into this function.

5.At the start of the program, the random number generator should be seeded using the current system time (if you have a question on this, check in the text it covers it explicitly).

6.Each function should have a comment block preceding it which explains what the function does (this includes main).

7.Your program should check to ensure the user hasn't entered an invalid number of rolls (for example 0, -1 are invalid) or more rolls than your program can handle (for example, if your array is only size 100,000 and the user enters 200,000). If the user enters an invalid number, it should ask the user to enter another number until a valid number is entered.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!