Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone please help me code this in c++? (not java or python). I am having a hard time.... Thank you! Exercise 2: N-sided Dice
Can someone please help me code this in c++? (not java or python). I am having a hard time.... Thank you!
Exercise 2: N-sided Dice Roller Create a dice rolling program. It should prompt the user to enter the number of sides (N) on the die they want to roll. The program should then generate a random number in the range 1 to N. After displaying the result, it should prompt the user, asking if they want to roll again. While the user answers "y", continue to roll again displaying the result, otherwise exit. HINT: Use, rand() as documented on and reviewed in zyBooks 2.19. Your program should return a *different* series of random numbers every time it is run. This requires "seeding" the random number generator with srand(). Example Output (underlined values are user inputs) Enter the number of sides on the die: 20 You rolled a 16. Do you want to roll again? (y) y You rolled a 5. Do you want to roll again? (y) y You rolled a 1 . Do you want to roll again? (y)n Enter the number of sides on the die: 2 You rolled a 1 . Do you want to roll again? (y)y You rolled a 2. Do you want to roll again? (y) y You rolled a 1 . Do you want to roll again? (y)nStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started