[Solved] Project 3.b

$25

File Name: Project_3.b.zip
File Size: 103.62 KB

SKU: [Solved] Project 3.b Category: Tag:
5/5 - (1 vote)

5/5 – (1 vote)

Write a 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 players turn continues, unless they choose to hold.

If a player chooses to hold, their turn total is added to their score, and it becomes the next players turn.

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

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

The first player to score 100 or more points wins. When the game is over, you should print the score for player 1 and player 2, and also print who won.

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

( When testing your program, you might find it useful to be able to get the same sequence of random values. To do that, you could pass a numeric literal to srand instead of using the time function, e.g. srand(42). Every time you use the same seed, youll get the same sequence.

Make sure you only seed the random number generator once in your program.)

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Project 3.b
$25