萌新,以前大学学过点VB,现在毕业工作后想学编程,从C++开始了,买的书是用VS2013的开发软件,在电脑里装的是VC++6.0
上午练习书本上的一个例题,出错,请大神帮忙指点
//2.11
#include<iostream>
using namespace std;
eunm gameresult {win,lose,tie,cancel};
int main(){
gameresult result; //这里声明关键字可以不写enum
enum gameresult omit=cancel;
for (int count=win;cout<=cancel;count++){
result=gamereslut(count);
if (result==omit)
cout<<"the game was cancelled"<<endl;
else {
cout<<"the game was played";
if (result==win)
cout<<"and we won!";
if (result==lose)
cout<<"and we lost";
cout<<endl;
}
}
return 0;
}
调试的结果显示错误
e:\vc\c++6.0_win7_xp85\microsoft visual studio\myprojects\lab210\la210.cpp(5) : error C2146: syntax error :
missing ';' before identifier 'gameresult'
e:\vc\c++6.0_win7_xp85\microsoft visual studio\myprojects\lab210\la210.cpp(5) : error C2501:
'eunm' : missing storage-class or type specifiers
e:\vc\c++6.0_win7_xp85\microsoft visual studio\myprojects\lab210\la210.cpp(5) :
fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.
la210.obj - 1 error(s), 0 warning(s)
