Question
This is C++. Write a program that determines a winner of a 2-player poker match. A poker hand of five playing cards drawn from a
This is C++. Write a program that determines a winner of a 2-player poker match. A poker hand of five playing cards drawn from a standard 52-card deck has a value, based on the table below. Each card has a rank (29, 10, Jack, Queen, King, or Ace) and a suit (, , , or ). The first character in each string will be the rank of the card and will be one of A23456789TJQK. The second character in the string will be the suit of the card and will be one of CDHS. Thus, "AS" represents the Ace of Spades, while "TC" represents the Ten of Clubs. Play with two players and use a string to enter names via the keyboard. Hands will be input from the keyboard with five card representations, separated by a single space between each card (convert to uppercase). If the user enters an illegal card or tries to enter the same card twice, the program will ignore the card, issue an error, and then request another card. Check for high card winners and check for ties. Hands are ranked first by category, then by individual card ranks. That is, even the minimum qualifying hand in a certain category defeats all hands in all lower categories. The smallest two pair hand, for example, defeats all hands with just one pair or no pair. Only between two hands in the same category are card ranks used to break ties. The highest single card in each flush or straight is used to break ties (the ace-through-five straight is the lowest straight, the ace being a low card in this context). Within two pair hands, the higher pairs are first compared. If they tie, then secondary pairs are compared, and then finally the kicker.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started