// // Card Class Header File // Described in Chapter 2 of // Data Structures in C++ using the STL // Published by Addison-Wesley, 1997 // Written by Tim Budd, budd@cs.orst.edu // Oregon State University // // Modified by Michael Redmond // La Salle University 2/00 -> 3/19/00 // 1) included operators > < == // 2) made default value an invalid card - negative rank // 3) made a joker exist (where joker is 15 of no suit) // 4) added isJoker function and isInvalid function (negative rank) // 5) added isFace which reports whether a card is a Face card or better (i.e. Ace and Joker count) # include //# include #include using namespace std; #ifndef CARD_H #define CARD_H enum suits {diamond, club, heart, spade, none}; class Card { public: // constructors Card ( ); // initialize a card with default (invalid) values Card (suits, int); // initialize a card with given values // inspectors bool isJoker() const; // reports if the card is a joker or not bool isInvalid() const; // reports if the card is invalid or not - happens sometimes such as when draw from an empty deck bool isFace() const; // reports if the card is a face card or better // data fields int rank; // hold rank of card suits suit; // hold suit of card }; bool operator == (const Card & leftCard, const Card & rightCard); bool operator > (const Card & leftCard, const Card & rightCard); bool operator < (const Card & leftCard, const Card & rightCard); ostream & operator << (ostream & out, const Card & aCard); #endif