CString AsString(const Card& card) { if (card.number() == 0 || card.suit() == 0) return CString("b"); // face down card CString s; s.Format("%c%c", ValueToChar(card.number()), SuitToChar(card.suit())); return s; }
std::string Card::ToString(void) const { std::stringstream ss; switch(m_number) { case 1: ss << "A"; break; case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: ss << m_number; break; case 11: ss << "J"; break; case 12: ss << "Q"; break; case 13: ss << "K"; break; default: assert(true); } ss << SuitToChar(m_suit); std::string str; ss >> str; return str; }