没理由编译不过
求圆周长,圆面积,圆球表面积,圆球体积,圆柱体积的程序,不过编译不过,提示是BT,BS,PT,L assigned a value which never use in funtion,和undefined symbol "L,S,BS" in funtion print
下面是源程序:
#include <stdio.h>
#include <conio.h>
#include <math.h>
long pi(void);
void print();
main()
{
int L,S,BS,BT,PT,r,h;
long n;
clrscr();
printf("Input the data:\n");
scanf("%d%d",&r,&h);
n=pi();
L=2*n*r;
S=n*r*r;
BS=4*n*r*r;
BT=(4/3)*n*r*r*r;
PT=S*h;
print();
}
long pi()
{
long sum=0;
int i=1,j=-1;
do
{
sum=sum+1/i;
j=j*1;
i+=2;
}while(sum>=pow(10,-6));
sum=sum/4;
return sum;
}
void print()
{
printf("L=%.2d",L);
printf("S=%.2d",S);
printf("BS=%.2d",BS);
printf("BT=%.2d",BT);
printf("PT=%.2d",PT);
}