#ifndef CARD_H #define CARD_H #include #include class Card { public: /* * First we define some convenient enumerations */ enum Value { NOVALUE = -1, ACE=1, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING }; enum Suit { 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) { }; /************************************************************************** * 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