Question: please code in c++ ---------------------------------------- In Dungeons & Dragons , and similar role-playing games, dice with different numbers of sides are used to determine the
please code in c++
----------------------------------------
In "Dungeons & Dragons", and similar role-playing games, dice with different numbers of sides are used to determine the outcomes of events throughout the game.
There are different dice for different occasions: 4-sided, 6-, 8-, 10-, 12-, and 20-sided dice are common.
A required roll is typically designated where is the number of sides on those dice. For example, 2d6 means throw two 6-sided dice and add the results, and 1d12 means throw one 12-sided die.
This lab requires you to write a program to read in the number of sides on the dice to throw, and then simulate throwing two of them and summing the result, three times in total.
For example, a program run might look like this:
Number of sides (4, 6, 8, 10, 12, or 20): 6 2d6 result: 3 + 2 = 5 2d6 result: 5 + 4 = 9 2d6 result: 2 + 2 = 4
Hints:
1) Read the input into an integer variable.
2) Do NOT change the seed in the srand() call from the starter code; it is required for the test runs to generate predictable results.
3) An N sided die should return results in the range 1..N.
4) You might want to review the documentation on rand().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
