注册 登录
编程论坛 C语言论坛

#新手小白#请大佬来看一下 为什么会出错啊

meirongliang 发布于 2020-05-28 13:09, 2600 次点击
#include <stdio.h>
void main()
{
    int scoer;
    scanf s("%d",&score);
    if((score>60||==60))
    {
        printf("this is a E");
        
    }
    else if((score>70||==70)&&score<80);
    {
        printf("this a  B");
    }
}

          看不懂这个[Error] '::main' must return 'int'
6 回复
#2
rjsp2020-05-28 13:45
看不懂这个[Error] '::main' must return 'int'
main 必须 返回 int
main函数的返回类型必须是int,从古至今一直都必须是int
#3
kangaroo12122020-05-29 15:49
void main对于一些老编译器是允许的,但C标准没有过这种写法,现在C标准要求int main这样的形式!
你写出这样的程序,应该说明你的程序估计来自十几年前的书籍内容吧,早过时了!
#4
ditg2020-05-29 22:38
谁说是老编译器了?抓狂……gcc 7.3也没警告提示,就是个编译器支持与否的问题
#5
rjsp2020-05-30 08:40
gcc4.4.7
warning: return type of 'main' is not 'int'

gcc7.3
warning: return type of 'main' is not 'int' [-Wmain]

gcc11.0.0
warning: return type of 'main' is not 'int' [-Wmain]
#6
ditg2020-05-30 10:49
只有本站会员才能查看附件,请 登录


查看一下CFLAGS里是否有-Wall编译选项
#7
forever742020-05-30 12:40
那个,嗯,估计,大概,
楼主的扩展名是cpp
1