#include "CardT.h" #include using namespace std; //enum class ResultT {HIGH, TIE, LOW, NONE}; string ResultTToString(ResultT result){ string value; switch (result) { case ResultT::HIGH: value = "High"; break; case ResultT::TIE: value = "Tie"; break; case ResultT::LOW: value = "Low"; break; case ResultT::NONE: default: value = "ERROR"; } return value; } std::string CardTToString(CardT card) { string result; string name; switch (card.value) { case 1: name = "Ace"; break; case 2: name = "Two"; break; case 3: name = "Three"; break; case 4: name = "Four"; break; case 5: name = "Five"; break; case 6: name = "Six"; break; case 7: name = "Seven"; break; case 8: name = "Eight"; break; case 9: name = "Nine"; break; case 10: name = "Ten"; break; case 11: name = "Jack"; break; case 12: name = "Queen"; break; case 13: name = "King"; break; } result = name + " of " + SuitTToString(card.suit) + 's'; return result; } CardT RandomCard(void) { CardT newCard; newCard.suit = RandomSuit(); newCard.value = rand() % 13+1; return newCard; } ResultT CompareCards(const CardT & card1, const CardT & card2){ ResultT result; if (card1.value == card2.value) { result = ResultT::TIE; } else if (card1.value < card2.value) { result = ResultT::LOW; } else { result = ResultT::HIGH; } return result; }