C++中switch语句的问题

来源:百度知道 编辑:UC知道 时间:2024/06/06 09:00:23
#include<iostream>
using namespace std;
int mian()
{
double score;
char grade;
cout<<"Please enter your data :";
cin>>score;
while(score>100||score<0)
{
cout<<"Error ! Please repeat your data:\n";
cin>>score;
}
switch((int)(score/10))
{
case 10:
case 9:grade='A';break;
case 8:grade='B';break;
case 7:grade='C';break;
case 6:grade='D';break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:grade='E';
}
cout<<"Your grade is :"<<grade<<" !"<<endl;
return 0;
}

为什么无法编译?
每次build都会出现如下语句:
--------------------Configuration: switch - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/s

int mian()
写错了,应该是int main(),编程要仔细,加油!!

unresolved external symbol _main;找不到main函数
结果呢你的却写错了

int mian()
打错了
int main()

字母错了 main()打快了吧?