Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. istream& operator>>(istream& in, Deck& deck)
  2.     {
  3.         char buf[2];
  4.         Rank cR;
  5.         Suit cS;
  6.         while(in >> buf) {
  7.             std::cout << buf;
  8.             char rAnk = buf[0]; //read first character as the rank
  9.             char suit = buf[1]; //read last character as the suit
  10.         if(rAnk=="2"){cR=TWO;}  //<- error: ISO C++ forbids comparison between pointer and integer[-fpermissive]
  11.                 //warning: comparison with string literal results in unspecified behavior[-Waddress]
  12.         if(rAnk=="3"){cR=THREE;}
  13.         if(rAnk=="4"){cR=FOUR;}
  14.         if(rAnk=="5"){cR=FIVE;}
  15.         if(rAnk=="6"){cR=SIX;}
  16.         if(rAnk=="7"){cR=SEVEN;}
  17.         if(rAnk=="8"){cR=EIGHT;}
  18.         if(rAnk=="9"){cR=NINE;}
  19.         if(rAnk=="10"){cR=TEN;}
  20.         if(rAnk=="J"){cR=JACK;}
  21.         if(rAnk=="Q"){cR=QUEEN;}
  22.         if(rAnk=="K"){cR=KING;}
  23.         if(rAnk=="A"){cR=ACE;}
  24.         if(suit=="C"){cS=CLUBS;}
  25.         if(suit=="D"){cS=DIAMONDS;}
  26.         if(suit=="H"){cS=HEARTS;}
  27.         if(suit=="S"){cS=SPADES;}
  28.         Card readCard(cR,cS);
  29.         for(int i=0; i<52; i++)
  30.         {
  31.             this->cardList[i] = readCard;
  32.             i++;
  33.         }
  34.         }
  35.  
  36.         return in;
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement