Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please Lab Element B --- Dice Game using Simulation This is a two die game using random numbers for input. - Generate a seed

C++ please

image text in transcribedimage text in transcribed

Lab Element B --- Dice Game using Simulation This is a two die game using random numbers for input. - Generate a seed using srand( ) and your computer's system time. You will need to do the following in your code: - time_t seed = time (); // define \& initialize seed variable - srand(seed); // seed random no. generator - for grins, you can see what happens if you do NOT seed the random no. generator. Comment out the line srand(seed); and run your code several times. Observe the output of the call to rand() - Generate random numbers between 1 and 6 to simulate rolls of 2 dice [rand()\%6 +1;// forces random values between 1 and 6...why?] - Add the sum of the 2 dice and compare the sum to the Winning, Losing, and Play Again conditions given below - Display appropriate text (see examples). You will need to keep rolling the dice until you either reach a winning or losing condition. Note: if you need to roll again, the variable in your code representing the sum of the two die should be reset to Condition Table Winning Conditions: 7, 9, and 11 Losing Conditions: 2,3 , and 5 Roll again conditions: 4, 6, and 12 . Sample Program Output

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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

Do you currently have a team agreement?

Answered: 1 week ago

Question

How will the members be held accountable?

Answered: 1 week ago