Question: C++ Write a program to keep track of a match consisting of a series of games between two people: player A and player B, and

C++

Write a program to keep track of a match consisting of a series of games between two people: player A and player B, and report the outcome. The input consists of a sequence of letters A or B. If the input is A, it indicates that A has won a game. If it is B, then it indicates B has won a game. The first player to win 5 or more games with a difference of 2 or more games between him and his opponent wins the match. If no player wins the match in 20 games then the match is declared a tie after these 20 games have been played.

INPUT ### The next n lines contain a char value each

c0

c1

...

cn n 20 .

ci is the outcome of the ith game.

It can take a value of either A/B.

A indicates that this game was won by Player A and B indicates that it was won by Player B.

The input will end when a player has won according to the given rules or 20 characters have been given.

OUTPUT At the end of the input, if player A wins, output A, If player B wins output B. If no one has won, output Tie Note: DO NOT output the quotes Please print a newline( using cout<

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!