Declare a scoped enum class named Mode representing GPIO operating modes with exactly four values, defined in the following order:
InputOutputPullUpPullDownThe enum must use uint8_t as its underlying type.
Implement a function:
const char* toString(Mode m);
This function must return the following string representations:
Mode::Input → "INPUT"Mode::Output → "OUTPUT"Mode::PullUp → "PULLUP"Mode::PullDown → "PULLDOWN"The program will read an integer value from standard input.
The input value is guaranteed to be in the range 0 to 3, where:
0 maps to Mode::Input1 maps to Mode::Output2 maps to Mode::PullUp3 maps to Mode::PullDownAfter mapping the integer to the corresponding enum value, print the string representation using toString().
Input
A single integer value in the range 0 to 3 (inclusive).
Output
A single uppercase string representing the corresponding GPIO mode.
Example 1
Input:
0
Output:
INPUT
Example 2
Input:
2
Output:
PULLUP
Constraints
x is guaranteed to be in the range 0 ≤ x ≤ 3uint8_ttoString() must return string literals (no std::string)<iostream> and <cstdint> may be used
Input
0
Expected Output
INPUT