C++中系统报错newline in constant是什么意思?

来源:百度知道 编辑:UC知道 时间:2024/06/07 07:14:32

一般从网页上直接拷代码下来编译时,许多全角符号没有转成半角符号,编译器不能识别,所以要手工把全角符号改成半角,如:“”等。

一般从网页上直接拷代码下来编译时,许多全角符号没有转成半角符号,编译器不能识别,所以要手工把全角符号改成半角,如:“”等。

#include<stdio.h>
int main()
{
float a,b,c,d;
float temp;
scanf("%f %f %f %f, &a, &b, &c, &d);
temp=a
if(temp<b)
temp=b;
if(temp<c)
temp=c;
if(temp<d)
temp=d;
printf("\nmax=%f",temp);
return 0;

}

error C2146: syntax error : missing ´)´ before identifier temp
error C2001: newline in constant

修改后为:
#include<stdio.h>
int main()
{
float a,b,c,d;
float temp;
scanf("%f %f %f %f", &a, &b, &c, &d);//这里有修改,少了一个"
temp=a;//这里少了一个分号
if(temp<b)
temp=b;
if(temp<c)
temp=c;
if(temp<d)
temp=d;
printf("\nmax=%f",temp);
return 0;
}

在程序的末尾点