#include #include #include Card::Card (std::string description) { std::istringstream s(description); char suitchar = 0; s >> suitchar; switch (std::tolower(suitchar)) { case 'c': suit = CLUBS; break; case 's': suit = SPADES; break; case 'h': suit = HEARTS; break; case 'd': suit = DIAMONDS; break; default: throw CARD_PARSE_ERROR; } int rankno = 0; s >> rankno; if (rankno >= 1 && rankno <= 13) { rank = rankno; } else { throw CARD_PARSE_ERROR; } } Card::Card(Suit nsuit; Rank nrank) { suit = nsuit; rank = nrank; } Card::Card(const Card &ncard) { suit = ncard.suit; rank = ncard.rank; } void Card::operator=(const Card &ncard) { suit = ncard.suit; rank = ncard.rank; } bool Card::operator==(const Card &ncard) { return (suit == ncard.suit) && (rank == ncard.rank); }