#include #include "SuitT.h" using namespace std; string SuitTToString(SuitT s){ string value; switch(s) { case SuitT::HEART : value = "Heart"; break; case SuitT::SPADE : value = "Spade"; break; case SuitT::CLUB : value = "Club"; break; case SuitT::DIAMOND : value = "Diamond"; break; case SuitT::NONE: default: value = "Unknown"; } return value; } string MakeLower(string s) { size_t i; for(i = 0 ; i < s.size(); ++i) { s[i] = static_cast(tolower(s[i])); } return s; } SuitT StringToSuitT(string name){ SuitT value{SuitT::NONE}; name = MakeLower(name); if (name == "heart"){ value = SuitT::HEART; } else if (name == "club") { value = SuitT::CLUB; } else if (name == "spade") { value = SuitT::SPADE; } else if (name == "diamond") { value = SuitT::DIAMOND; } return value; } SuitT NextSuit(SuitT s){ SuitT value{SuitT::NONE}; if (s < SuitT::NONE) { value = static_cast(static_cast(s) + 1); } return value; } SuitT RandomSuit(){ int randomValue; SuitT value; randomValue = rand() % static_cast(SUIT_COUNT); value = static_cast(randomValue); return value; }