Operator Overloading¬† ¬ęPrev¬†

Overloading Stream Extraction Operator >> - Exercise

Objective: Overload the input operator for the card class.

Instructions

Given the following code for a playing card ADT, overload the input operator >> for the card.
You do not need to handle all 52 cases, just indicate how you would have to handle them in case you where required to.

#include  <iostream.h>

char  pips_symbol[14] = { '?', 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K' };
char  suit_symbol[4] = { 'c', 'd', 'h', 's' };

enum suit { clubs, diamonds, hearts, spades };

class pips {
public:
  void  assign(int n) { p = n % 13 + 1; }
private:
  int  p;
};

#include  <iostream.h>

char  pips_symbol[14] = { '?', 'A', '2', '3', '4',  '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K' };
char  suit_symbol[4] = { 'c', 'd', 'h', 's' };

enum suit { clubs, diamonds, hearts, spades };

class pips {
public:
   void  assign(int n) { p = n % 13 + 1; }
private:
   int  p;
};

class card {
public:
   suit  s;
   pips  p;
   void  assign(int n) 
     { cd = n; s = suit(n / 13); p.assign(n); }
private:
   int  cd;       //a cd is from 0 to 51
};

The above code can be cut and paste from above and used as part of your solution.
Paste your code below and click the Submit button when you are ready to submit this exercise.