淡定一点 发表于 2014-6-15 22:27:45

c语言求助

#include<stdio.h>
main()
{
        int score;
        scanf("%d",&score);
    if(socre < 60)
        {
                printf("The score is E!");
        }
        else if((score > 60 || score == 60) && score < 70)
        {
                printf("The score is D!");
        }
        else if((score > 70 || score == 70) && score < 80)
        {
                printf("The score is C!");
        }
        else if((socre > 80 || socre == 80) && socre < 90)
        {
                printf("The socre is B!");
        }
        else
        {
                printf("The socre is A!");
        }


       
}
为什么我编译之后提示
E:\vc++\MSDev98\MyProjects\555555555\rr.cpp(6) : error C2065: 'socre' : undeclared identifier
E:\vc++\MSDev98\MyProjects\555555555\rr.cpp(29) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.

rr.obj - 1 error(s), 1 warning(s)
这是出了什么问题吗??


santaclaus 发表于 2014-6-15 22:44:20

'socre' ?:sweat:

未闻丶花名 发表于 2014-6-16 00:00:24

拼写错误骚年,是score不是socre

惊鸿夹雪 发表于 2014-6-16 08:01:14

没加return 0;

淡定一点 发表于 2014-6-16 13:07:09

哈哈哈 我真是太不小心了 谢谢楼主们

风之残月 发表于 2014-6-16 22:01:07

"score" 写成了 "socre" , 如果 main() 前面没有返回值类型,默认是 int, 最后应该写一句, return 0(也可以是其它的整数);
页: [1]
查看完整版本: c语言求助