#include<iostream>
#include<fstream>
using namespace std;
main()
{
int i,j;
float a[4097];
FILE *fp;
if((fp=fopen("e:\\123.txt","r"))==NULL)
{
printf("1cannot open file!\n");
return 0;
}
for(j=1;j<=4096;j++)
fscanf(fp,"%f",&a[j]);
fclose(fp);
float x,R=0.5,b;
x=a[j];
if(x>R)
b=12.56*(1+0.75*(x/R)*(x/R));
else
{
b=12.56*(0.5*(R/x)*(R/x)*(R/x)+0.5625*(R/x)*(R/x)*(R/x)*(R/x)*(R/x));
}
cout<<"b="<<b<<endl;
}
高手给看看;