这是我为练习做的代码.当我编译它时,它不允许cin >> choice被编译.它说" 错误2错误C2088:'>>':类非法 "和" 错误1错误C2371:'选择':重新定义;不同的基本类型 "我能就如何解决这个问题得到一些建议吗?非常感激!
#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 << …
Run Code Online (Sandbox Code Playgroud)