Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- istream& operator>>(istream& in, Deck& deck)
- {
- char buf[2];
- Rank cR;
- Suit cS;
- while(in >> buf) {
- std::cout << buf;
- char rAnk = buf[0]; //read first character as the rank
- char suit = buf[1]; //read last character as the suit
- if(rAnk=="2"){cR=TWO;} //<- error: ISO C++ forbids comparison between pointer and integer[-fpermissive]
- //warning: comparison with string literal results in unspecified behavior[-Waddress]
- if(rAnk=="3"){cR=THREE;}
- if(rAnk=="4"){cR=FOUR;}
- if(rAnk=="5"){cR=FIVE;}
- if(rAnk=="6"){cR=SIX;}
- if(rAnk=="7"){cR=SEVEN;}
- if(rAnk=="8"){cR=EIGHT;}
- if(rAnk=="9"){cR=NINE;}
- if(rAnk=="10"){cR=TEN;}
- if(rAnk=="J"){cR=JACK;}
- if(rAnk=="Q"){cR=QUEEN;}
- if(rAnk=="K"){cR=KING;}
- if(rAnk=="A"){cR=ACE;}
- if(suit=="C"){cS=CLUBS;}
- if(suit=="D"){cS=DIAMONDS;}
- if(suit=="H"){cS=HEARTS;}
- if(suit=="S"){cS=SPADES;}
- Card readCard(cR,cS);
- for(int i=0; i<52; i++)
- {
- this->cardList[i] = readCard;
- i++;
- }
- }
- return in;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement