#ifndef CARD_H #define CARD_H #include #include class Card { public: /* * First we define some convenient enumerations */ enum Value { DELETEDVALUE = -2, NOVALUE = -1, ACE=1, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING }; enum Suit { DELETEDSUIT = -2, NOSUIT = -1, CLUB=0, DIAMOND, HEART, SPADE}; Value value; // e.g. value = Card::QUEEN Suit suit; // e.g. suit = Card::HEART /** * Constructor */ Card(Value v = NOVALUE, Suit s = NOSUIT) : value(v), suit(s) { }; /** * Destructor - intentionally trash the settings */ ~Card() { value = DELETEDVALUE; suit = DELETEDSUIT; }; bool operator==(const Card& other) const; bool operator!=(const Card& other) const; /************************************************************************** * Some convenient utilities for converting between enums and strings/characters **************************************************************************/ static char* suitName(Suit s); static char toChar(Suit s); static char toChar(Value v); static Suit toSuit(char key); static Value toValue(char key); }; /* * print card information */ std::ostream& operator<<(std::ostream& out, const Card& c); #endif