Question: c++ Write a program that emulates rolling a dice. a) Create a roll() function to find the outcome of a 6-side dice roll and return
c++

Write a program that emulates rolling a dice. a) Create a roll() function to find the outcome of a 6-side dice roll and return the result of a single dice roll. b) Overload the roll function to find dice rolls of a specific dice size. 1. Accept the dice size as a parameter. 2. Return the result of a single dice roll. e) Overload the roll() function 1. Accept the dice size as a parameter, n. 2. Accept the number of rolls as a second input parameter, r. 3. Accept the third pass-by-reference parameter to calculate the sum of r rolls of an n-side dice. For example, roll 12, 9, sum) will calculate the sum of a 29 (2 rolls of a 9-side dice). d) main() handles function calls and output. 1. Output a 6-side dice three times. 2. Output a 10-, 20- and, 30-side dice once time each. 3. Output the sums by calling roll (3, 7, sum), roli (2, 8, sum), and roll (5, 10, sum). 4. Use current time as the seed to generate all the numbers. Example Output: Roll (6): 3 Roll (6): 2 Roll (6): 4 Roll (10): 10 Roll (20): 3 Roll (30): 12 Roll (307): 14 Roll (2dB): 7 Roll (5d10): 24
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
