#include #include #include using namespace std; enum ResultT {YELLOW_SIGN, TENTACLE, ELDER_SIGN, CTHULHU, EYE, UNKNOWN}; const ResultT FIRST_RESULT = YELLOW_SIGN; const size_t RESULT_RANGE = UNKNOWN - YELLOW_SIGN; string ResultTToString(ResultT value); ResultT NextResultT(ResultT value); int main() { ResultT i; int j; for(i = FIRST_RESULT; i < UNKNOWN; i =NextResultT(i)) { cout << i << setw(20) << ResultTToString(i) << endl; } cout << endl; cout << endl; cout << "Some random results" << RESULT_RANGE << endl; for(j = 0; j < 10; j++) { i = static_cast(rand() % RESULT_RANGE); cout << i << setw(20) << ResultTToString(i) << endl; } return 0; } ResultT NextResultT(ResultT value) { ResultT result = UNKNOWN; if (value != UNKNOWN) { result = static_cast(static_cast(value) + 1) ; } return result; } string ResultTToString(ResultT value) { string result; switch (value) { case YELLOW_SIGN: result = "Yellow Sign"; break; case TENTACLE: result = "Tentacle"; break; case ELDER_SIGN: result = "Elder Sign"; break; case CTHULHU: result = "Cthulhu"; break; case EYE: result = "EYE"; break; case UNKNOWN: [[fallthrough]]; default: result = "Unknown Result"; } return result; }