Question: Instructions Write a C++ program, named DiceRoll.cpp, that contains a function named roll ) * Return type: int Name: roll Parameters: o int sides: number

 Instructions Write a C++ program, named DiceRoll.cpp, that contains a functionnamed roll ) * Return type: int Name: roll Parameters: o intsides: number of sides in the die o double *weights: a pointer

Instructions Write a C++ program, named DiceRoll.cpp, that contains a function named roll ) * Return type: int Name: roll Parameters: o int sides: number of sides in the die o double *weights: a pointer to an array of weight values for each side in the die weights [0]: weight value for Side 1 weights [1]: weight value for Side 2 This function should simulate a roll of the weighted die, given its number of sides and weight values for each side. It should return a value between 1 and sides. In the main () function, test the roll ) function by calling it 100,000 times and keeping track of the number of rolls for each side of a weighted coin flip Die with 2 sides (sum of all weights -2 0.5 2.5) Side Weight Probability 2 / 2.5 80% 0.5 12.5 20% 0.5

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!