C语言执行 cl.exe 时出错
#include<stdio.h>#definePI3.14main(){intr;floats,1;r=2;s=PI*r*r;1=2*r*PI;printf("s=%f...
#include<stdio.h>
#define PI 3.14
main()
{int r; float s,1;
r=2;
s=PI*r*r;
1=2*r*PI;
printf("s=%f 1=%f",s,1);
}
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(4) : error C2059: syntax error : 'constant'
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(6) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(7) : warning C4244: '=' : conversion from 'double' to 'const int', possible loss of data
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(7) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(9) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
Cpp1.exe - 1 error(s), 0 warning(s) 展开
#define PI 3.14
main()
{int r; float s,1;
r=2;
s=PI*r*r;
1=2*r*PI;
printf("s=%f 1=%f",s,1);
}
--------------------Configuration: Cpp1 - Win32 Debug--------------------
Compiling...
Cpp1.cpp
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(4) : error C2059: syntax error : 'constant'
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(6) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(7) : warning C4244: '=' : conversion from 'double' to 'const int', possible loss of data
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(7) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(9) : warning C4508: 'main' : function should return a value; 'void' return type assumed
执行 cl.exe 时出错.
Cpp1.exe - 1 error(s), 0 warning(s) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |