按你的程式作了必要的幾處修改:
#include
#include
#define Pi 3.1415927
int main()
{
double Input,ra,f;
printf("Please input your number to calcution what you want\n\n1.Ball's Volume\n2.Surface Area of The Ball\n\n");
scanf("%lf", &Input);
if (Input == 1)
{
printf(" \n\n\nV=(4/3)Pi*r^3\nPlease input 'r'\n");
scanf("%lf",&ra);
f = (4 * Pi * ra * ra * ra / 3);
printf("%lf",f);
getch();
}
return 0;
}
程式能夠運作了:
但是你的 2.Surface Area of The Ball 程式還未加入。