#include<stdio.h>
int main(void)
{
int i,n;
double h,r,v;
/*函数的声明*/ double cylinder(double r,double h);
printf("Enter n:");
scanf("%d",&n);
for(i=1;i<=n;i++){
printf("Enter r and h:\n");
scanf("%lf%lf",&r,&h);
if((r<0)||(h<0)){
printf("输入错误");
}
else{
v=cylinder(r,h);
printf("V=%.3f\n",v);
}
}
return 0;
}
double cylinder(double r,double h)
{
/*对函数的定义*/ double result;
result=3.1415926*r*r*h;
return result;
}