Emulate the rolling of dice. a) Write a roll function which accepts the number of dice sides
Question:
Emulate the rolling of dice.
a) Write a roll function which accepts the number of dice sides as input and returns the
result of a random dice roll of the specified size.
b) Overload the roll function to accept the number of rolls as a second input parameter.
The overloaded function should return a random value which is the sum of r rolls of an n
sided die.
c) Test the first function with various dice sizes (see output).
d) Test the second function with various values (see output).
e) The program should generate new random values every time it runs.
Note that dice values start at 1.
Example Output (input in bold italics)
6-sided: 6
12-sided: 7
20-sided: 16
3d7: 11
2d8: 12
4d5: 7
c++, write on atom software.
Elementary Statistics A step by step approach
ISBN: 978-0073386102
8th edition
Authors: Allan Bluman