This is a code i did for practice. when i compile this, it wldnt allow cin >> choice to be compiled. It says "Error 2 error C2088: '>>' : illegal for class" and "Error 1 error C2371: 'choice' : redefinition; different basic types" Can i get some advise on how to solve this? much appreciated!
#include <iostream>
using namespace std;
int main()
{
cout << "Difficulty levels\n\n";
cout << "Easy - 0\n";
cout << "Normal - 1\n";
cout << "Hard - 2\n";
enum options { Easy, Normal, Hard, Undecided };
options choice = Undecided;
cout << "Your choice: ";
int choice;
cin >> choice;
switch (choice)
{
case 0:
cout << "You picked Easy.\n";
break;
case 1:
cout << "You picked Normal. \n";
break;
case 2:
cout << "You picked Hard. \n";
break;
default:
cout << "You made an illegal choice.\n";
}
return 0;
}