#include <iostream> #include <cstdint> // Declare enum class PinState with underlying type uint8_t // Values: Low, High // Implement: const char* toString(PinState s) enum class PinState : uint8_t { Low, High }; const char* toString(PinState s){ if(s==PinState::Low){ return "LOW"; } else{ return "HIGH"; } } int main() { int x; std::cin >> x; PinState s = (x == 0) ? PinState::Low : PinState::High; std::cout << toString(s); return 0; }
Test Cases
Test Results
Expected Output
LOW