-The program attached complies correctly I just need the program to be separated into functions and files and match the sample output below when it runs. AssignmentUsing main.cpp downloadas a starting...

1 answer below »


-The program attached complies correctly I just need the program to be separated into functions and files and match the sample output below when it runs.
AssignmentUsing main.cpp downloadas a starting point, write a program that inputs two simplified poker hands and determines which (if either) of the hands is the winner, according to the following rules:
If the two hands have different types (3-of-kind, straight, pair, high-card), the hand with the better type (i.e., appears earlier in this list) wins.If they have the same type, the higher significant card wins.If the hands have the same type and significant card, there is no winner (a tie).Note that the only significant factors are four types of hand and what is the significant card (high card or card in a pair/triple). In real poker, a tie in the criteria above would be resolved by comparing the non-pair or next-highest card. You may do this if you wish, but it is not required.Additional Assignment RequirementsYour program must be decomposed into functions and files. You should not have more than one function that does the same thing. For example, there should be one function (with three reference parameters) that inputs a hand. This function can be used twice (passing different cards as parameters) in order to input the two hands.You may only use concepts and language features presented in class so far (i.e., chapters 1-6 + lecture/demo on separate compilation).
Please make sure that the files are named properly (especially the source code files (e.g., main.cpp, tools.cpp, tools.h, cards.h, and cards.cpp).
SAMPLE OUTPUTEnter the 1st hand.Card 1: 10Card 2: 10Card 3: 10
Enter the 2nd hand.Card 1: 4Card 2: 5Card 3: 6three tens beats a six-high straight.
Do you want to go again (y/n)? y
Enter the 1st hand.Card 1: 13Card 2: 12Card 3: 11
Enter the 2nd hand.Card 1: 1Card 2: 2Card 3: 3a king-high straight beats a three-high straight.
Answered Same DayMay 05, 2021

Answer To: -The program attached complies correctly I just need the program to be separated into functions and...

Arun Shankar answered on May 06 2021
139 Votes
cards.h
#ifndef CARDS_H
#define CARDS_H
// input range
const int LOW_CARD_VALUE = 1;
const int HIGH_C
ARD_VALUE = 13;
// numeric values of cards
const int ACE_VALUE = 1;
const int MINIMUM_UNNAMED_CARD_VALUE = 2;
const int MAXIMUM_UNNAMED_CARD_VALUE = 10;
const int JACK_VALUE = 11;
const int QUEEN_VALUE = 12;
const int KING_VALUE = 13;
// face card names
const string ACE_NAME = "ace";
const string JACK_NAME = "jack";
const string QUEEN_NAME = "queen";
const string KING_NAME = "king";
// non-face card (number) names
const string NUMBER_2_NAME = "two";
const string NUMBER_3_NAME = "three";
const string NUMBER_4_NAME = "four";
const string NUMBER_5_NAME = "five";
const string NUMBER_6_NAME = "six";
const string NUMBER_7_NAME = "seven";
const string NUMBER_8_NAME = "eight";
const string NUMBER_9_NAME = "nine";
const string NUMBER_10_NAME = "ten";
typedef struct Hand
{
    int smallestCard;
    int medianCard;
    int largestCard;
    bool is3OfAKind = false;
    bool isStraight = false;
    bool isPair = false;
    int keyCard;
    string...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here