不知道问题出在哪
#include <stdio.h>#define PI 3.1415926;
void main(void)
{
double a=3.0;
double b=PI*a*a;
printf("\na=%f",a);
}
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2100: illegal indirection
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : warning C4552: '*' : operator has no effect; expected operator with side-effect
执行 cl.exe 时出错.
#include <stdio.h>
#define PI 3.1415926
void main(void)
{
float f radius = 3.0;
float f area = PI*f radius*f raduis;
printf("\n area=%f",area);
}
怎么回事我试了好多次还是有问题,求前辈指教,新手上路
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(5) : error C2146: syntax error : missing ';' before identifier 'radius'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(5) : error C2065: 'radius' : undeclared identifier
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(5) : warning C4244: '=' : conversion from 'const double' to 'int', possible loss of data
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2146: syntax error : missing ';' before identifier 'area'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2086: 'f' : redefinition
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2065: 'area' : undeclared identifier
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2146: syntax error : missing ';' before identifier 'radius'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2146: syntax error : missing ';' before identifier 'raduis'
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : warning C4552: '*' : operator has no effect; expected operator with side-effect
E:\游戏\Microsoft Visual Studio\MyProjects\w\x.cpp(6) : error C2065: 'raduis' : undeclared identifier
执行 cl.exe 时出错.
求前辈赐教,谢谢