C++编程是出现undeclared identifier,请各位大虾帮我看看

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:05:47
#include<stdio.h>
main()
{
int i,sum,m;
sum=o;
printf("please input m:");
scanf("%d",&m);
for(i=1,i<=m;i++)
sum+=i;
printf("The sum is:%d\n",sum);
}

--------------------Configuration: ghg - Win32 Debug--------------------
Compiling...
ghg.c
E:\ghg\ghg.c(5) : error C2065: 'o' : undeclared identifier
E:\ghg\ghg.c(8) : error C2143: syntax error : missing ';' before ')'
执行 cl.exe 时出错.

ghg.obj - 1 error(s), 0 warning(s)

#include<stdio.h>
main()
{
int i,sum,m;
sum=0; //这个是0,你写成了'欧'
printf("please input m:");
scanf("%d",&m);
for(i=1;i<=m;i++) //i=1后面应该是分号
sum+=i;
printf("The sum is:%d\n",sum);
}