How to make this use a enum
I'm currently reading Beginning C++ Through Game Development, 2nd Edition and there's an exercise that reads like this: "Rewrite the Menu Chooser program from this chapter using an enumeration to represent difficulty levels. The variable choice will still be of type int."
I need some help solving this exercise. Here's the code for Menu Chooser:
Code:
// Menu Chooser
// Demonstrates the switch statement
#include <iostream>
using namespace std;
int main()
{
cout << "Difficulty Levels\n\n";
cout << "1 - Easy\n";
cout << "2 - Normal\n";
cout << "3 - Hard\n\n";
int choice;
cout << "Choice: ";
cin >> choice;
switch (choice)
{
case 1:
cout << "You picked Easy.\n";
break;
case 2:
cout << "You picked Normal.\n";
break;
case 3:
cout << "You picked Hard.\n";
break;
default:
cout << "You made an illegal choice.\n";
}
return 0;
}