// File: ex8-6.cpp
#include <iostream>
using namespace std;
const char* suit_name[4] = {"clubs","diamonds","hearts","spades"};
const char* pips_name[13] = {"two","three","four","five","six","seven","eight",
"nine","ten","jack","queen","king","ace"};
class Card
{
private:
int suit;
int pips;
public:
Card(int=0);
friend ostream& operator<<(ostream&,const Card&);
};
Card::Card(int x) : suit(x/13), pips(x%13)
{ }
ostream& operator<<(ostream& s,const Card& c)
{
s << pips_name[c.pips] << " of " << suit_name[c.suit] << endl;
return s;
}
int main (void)
{
Card c1(47);
Card c2;
cout << c1;
cout << c2;
cout << Card(3) << Card(4);
}