请有人帮我修复:圆柱体的体积,但我不断收到错误:
#include <stdio.h>
int main()
{
const float pi = 3.14;
float r, h, vol;
printf("Enter Radius Of the Cylinder.\n");
scanf("%f", &r);
printf("Enter Height of the Cylinder.\n");
scanf("%f", h);
vol = r * r * pi * h;
printf("Volume Of Cylinder is %f", vol);
return 0;
}
请有人帮我解决!
你没有在
h
中传递scanf("%f", h)
的地址的bug。用这个代替:
scanf("%f", &h);