#include <iostream> #include <cstdint> using namespace std; // your code here :- declare enum class ErrorCode // ErrorCode has 4 values of type uint8_t --> None, Timeout, Overflow and Invalid enum class ErrorCode: uint8_t {None, Timeout, Overflow, Invalid}; const char* toString(ErrorCode e) { // your code here // define a function that returns the string of input error code // eg : error code : None , function return : "None" string const char* names[] = {"None", "Timeout", "Overflow", "Invalid"}; return names[static_cast<size_t>(e)]; } int main() { int x; cin >> x; ErrorCode e = static_cast<ErrorCode>(x); cout << toString(e); return 0; }
Test Cases
Test Results
Input
0
Expected Output
None