#include <iostream> #include <string> using namespace std; enum class Command { Start, Stop, Reset }; void execute(Command c) { switch (c) { case Command::Start: cout << "STARTING..."; break; case Command::Stop: cout << "STOPPING..."; break; case Command::Reset: cout << "RESETTING..."; break; } } int main() { string cmd; cin >> cmd; Command c = Command::Start; // default if(cmd == "Start") { c = Command::Start; } else if(cmd == "Stop") { c = Command::Stop; } else { c = Command::Reset; } // your code here: assign c based on input string execute(c); return 0; }
Test Cases
Test Results
Input
Start
Expected Output
STARTING...