Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that allows 2 people to play a simple dice game. The game should alternate between players until one of them has

Write a C++ program that allows 2 people to play a simple dice game. The game should alternate between players until one of them has won. The rules are as follows:

Each turn, a player repeatedly rolls two dice:

- If no 1s are rolled, the sum of the dice is added to their turn total and the player's turn continues.

- If a player chooses to "hold", their turn total is added to their score, and it becomes the next player's turn.

- If a single 1 is rolled, the player scores nothing for that round and it becomes the next player's turn.

- If two 1s are rolled, the players entire score is lost, and it becomes the next player's turn.

The first player to score 100 or more points wins.

You should seed the random number generator using the time() function.

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

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

8 0 y hea Iosy 0 sy to to t 4 y 2 Y h 1 Y3 Y

Answered: 1 week ago