Question: Write a c++ code for this dice game: The rules of the game: first the players agree on a certain number of rounds n they

Write a c++ code for this dice game:

The rules of the game: first the players agree on a certain number of rounds n they want to play. In each round each player throws a dice with distinct numbers from 1 to 6 written on its faces. The player with the larger number win the round, but there could also be a draw if both numbers are equal. The player who wins more rounds is the winner of the game. Again, there could be a draw if both players win the same number of rounds.

The c++ code should keep track of all the wins and losses.

Input: The first line of the input contains a single integer n n (1n100) the number of game rounds. The next n lines contain the descriptions of the n rounds. The i-th line contains a pair of integers ai and hi (1ai,hi6) values on the dice upper face after the two player's throws in the i-th round, respectively.

Output should have exactly one line. If player1 is the winner of the game, print "Player 1". If player2 is the winner of the game, print "Player 2". If the result is draw, print "Draw".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!