第1个回答 推荐于2017-09-21
正确的代码如下:
#define PI 3.14159 //此处不要加"="
int main() //可以加个int
{
float R,H;
float S;
float V;
R=6.0;
H=7.0;
S=PI*R*R; //就这一行编译时出现“expression syntax"
V=S*H;
printf("%f",V); // 这里要加上";"
return 0; //返回值(配合int main()使用)
}
其他的地方就没有问题了本回答被提问者采纳
第2个回答 2008-08-20
语法错误
正确做法 #define PI 3.14159
define的作用简单来说就是字符串替换 这也是你出现表达式错误的原因所在
第3个回答 2008-08-20
#define PI=3.14159
你这里错了。
不要有=号,
加了的话你后面就相当于
S==3.14159*R*R; 两个等号了
第4个回答 2008-08-20
最后一句printf("%f", V);少了个分号