回复 2楼 pangshch
改了之后还是不行啊,
#include<stdio.h>
#define pi 3.1415926
#include<math.h>
int main()
{
char n;
double a,b,c,s1,s2,s3,s4;
while(scanf("%s",&n)!=EOF)
{
switch(n)
{
case 'Cylinder':scanf("%lf %lf",&a,&b);s1=pi*a*a*b;break;
case 'Cuboid':scanf("%lf %lf %lf",&a,&b,&c);s2=a*b*c;break;
case 'Cone':scanf("%lf %lf",&a,&b);s3=(pi*a*a*b)/3;break;
case 'Ball':scanf("%lf",&a);s4=(4*pi*a*a)/3;break;
}
printf("%.3lf\n",s1+s2+s3+s4);
}
return 0;
}
就出现这个错误
too many characters in constant ,应该是说字符太长吧