1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include "PlayingCard.h"
#include <string>
std::string PlayingCard::getCardCode()
{
char codeVal[] = {'X', 'A', 2, 3, 4, 5, 6, 7, 8, 9, 'T', 'J', 'Q', 'K'};
char codeSuit[] = {'S', 'C', 'D', 'H'};
std::string code[] = {codeVal, codeSuit};
return code[2]();
}
bool PlayingCard::setCard(char myValue, char mySuit)
{
if((mySuit == 'S' || mySuit == 'C' || mySuit == 'D' || mySuit == 'H') && (myValue >= 2 || myValue <= 9 || myValue == 'A' || myValue == 'T' || myValue == 'J' || myValue == 'Q' || myValue == 'K'))
return true;
else
return false;
}
bool PlayingCard::isValid()
{
char Value = value, Suit = suit;
if((Value >=2 || Value <=9 || Value == 'A' || Value == 'T' || Value == 'J' || Value == 'Q' || Value == 'K') && (Suit == 'S' || Suit == 'C' || Suit == 'D' || Suit == 'H'))
return true;
else
return false;
}
PlayingCard::~PlayingCard()
{
//dtor
}
|