#include #include using namespace std; class Card { private: int pips; int suit; public: Card(int n = 0) : pips(n % 13), suit(n / 13) { } bool operator>(const Card& c) const { return pips > c.pips; } static const string pips_name[13]; static const string suit_name[4]; friend ostream& operator<<(ostream&, const Card&); }; const string Card::pips_name[13] = {"two","three","four","five","six","seven", "eight","nine","ten","jack","queen","king","ace"}; const string Card::suit_name[4] = {"clubs","diamonds","hearts","spades"}; ostream& operator<<(ostream& out, const Card& card) { out << Card::pips_name[card.pips] << " of " << Card::suit_name[card.suit]; return out; } template const T& Max(const T& a, const T& b) { return (a > b) ? a : b; } int main(void) { cout << Max(3,4) << endl; Card c1(23), c2(9); cout << c1 << endl; cout << c2 << endl; cout << Max(c1,c2) << endl; }