Answered step by step
Verified Expert Solution
Link Copied!

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!

image text in transcribed

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)n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is cultural tourism and why is it growing?

Answered: 1 week ago

Question

4. Describe the role of narratives in constructing history.

Answered: 1 week ago

Question

1. Identify six different types of history.

Answered: 1 week ago