/* * Place identifying information here. */ #include #include #include #include using namespace std; enum class ColorT {RED, YELLOW, GREEN, CYAN, BLUE, MAGENTA, NO_COLOR}; const ColorT FIRST_COLOR = ColorT::RED; const size_t COLOR_COUNT = static_cast(ColorT::NO_COLOR); ColorT NextColorT(ColorT color); string ColorTToString(ColorT color); ColorT StringToColorT(string word); string ToUpperString(string word); ColorT RandomColor(void); int main() { return 0; } ColorT NextColorT(ColorT color) { ColorT result = ColorT::NO_COLOR; if(color < ColorT::NO_COLOR) { result = static_cast(static_cast(color) + 1); } return result; } string ColorTToString(ColorT color) { string result; switch(color) { case ColorT::RED: result = "red"; break; case ColorT::GREEN: result = "green"; break; case ColorT::BLUE: result = "blue"; break; case ColorT::CYAN: result = "cyan"; break; case ColorT::MAGENTA: result = "magenta"; break; case ColorT::YELLOW: result = "yellow"; break; case ColorT::NO_COLOR: [[fallthrough]]; default: result = "Color Not Defined"; } return result; } ColorT StringToColorT(string word) { ColorT result = ColorT::NO_COLOR; word = ToUpperString(word); if (word == "RED"){ result = ColorT::RED; } else if (word == "GREEN") { result = ColorT::GREEN; } else if (word == "BLUE") { result = ColorT::BLUE; } else if (word == "CYAN") { result = ColorT::CYAN; } else if (word == "MAGENTA") { result = ColorT::MAGENTA; } else if (word == "YELLOW") { result = ColorT::YELLOW; } return result; } string ToUpperString(string word){ size_t i; for(i = 0; i < word.size(); i++) { word[i] = static_cast(toupper(word[i])); } return word; } ColorT RandomColor(){ ColorT result; result = static_cast(rand() % COLOR_COUNT ); return result; }