#include <iostream>
#include <cstdint>
using namespace std;

// your code here :- declare enum class ErrorCode 
enum class ErrorCode{
None,
Timeout,
Overflow,
Invalid
};
// ErrorCode has 4 values of type uint8_t --> None, Timeout, Overflow and Invalid 

const char* toString(ErrorCode e) {

   switch(e){
      case ErrorCode::None: return "None";
      case ErrorCode::Timeout: return "Timeout";
      case ErrorCode::Overflow: return "Overflow";
      case ErrorCode::Invalid: return "Invalid";
        default : return "Unknown";
   };

	// your code here
	// define a function that returns the string of input error code
	// eg : error code : None , function return : "None" string
}

int main() {
   int x;
   cin >> x;
   ErrorCode e = static_cast<ErrorCode>(x);
   cout << toString(e);
   return 0;
}
Upvote
Downvote
Loading...

Input

0

Expected Output

None