定义一个数组,能不能用循环语句一个个计算赋值,再输出呀,我编的没错误,可不能正常运行呀。
请问一下高手怎么回事呀???
#include<stdio.h>
#include<math.h>
float lre(float u,float d)
{
float re,v, float tf[3][10000];
int i,j;
v=(8.123*(tf[i][j]-273.15)*(tf[i][j]-273.15)*1e-5+9.1945*0.01*(tf[i][j]-273.15)+13.198)*1e-6;
re=u*d/v;
return (re);
}
float hr(float d,float k,float u)
{
float r=0.0276/d;
float h1,h,h2,x,a,float tf[3][10000];
x=lre(u,d);
a=d/k;
if(x>2300)
{
h1=0.226421*r*pow(a,0.318257)*pow(x,0.631779);
h2=0.357498*r*pow(a,0.311957)*pow(x,0.600192);
h=(h1+h2)/2;
return(h);
}
else
h1=0.866633*r*pow(a,0.46642)*pow(x,0.453158);
h2=1.494713*r*pow(a,0.85346)*pow(x,0.405349);
h=(h1+h2)/2;
return(h);
}
#define USER_INPUT 0 //如果它为1的话,就用键盘输入,如果为0的话,就直接用默认值。
void main()
{
int i,j;
float u,ts,n,l,p,r,c;
float t[3][10000],tf[3][10000];
float d,h,k,e,y,s,a,v,qv,qv1;
float p1=1.17,cp1=1.005,p2=8070,cp2=436;
#if (USER_INPUT)
printf("input u,d,k,ts,n,l,e,ui,iu:\n");
scanf("%f,%f,%f,%f,%f,%f,%f,%f",&u,&d,&k,&ts,&n,&l,&);
#else
u=6,d=0.009,k=0.08,ts=50,n=20,l=3,e=0.001,p=60;
#endif
s=8*n*(l*k+l*e);
a=4*n*d*k;
v=4*n*l*k*e;
qv=p*ts;
tf[0][0]=313;
t[0][0]=313;
for(j=0;j<ts;j++)
{
c=p2*cp2*v;
for(i=0;i<3;i++)
h=hr(u,d,k);
r=h*a;
qv1=qv*v/4+p1*cp1*(tf[i][j]-t[i][j-1]+qv*v/(4*h*s))*exp(-ts/r/c);
tf[i][j]=(u*t[i-1][j]+qv1/l/d/cp1+u*t[i][j-1])/(u+p1*l);
t[i][j]=tf[i][j]+qv*v/(4*h*s)-(tf-t+qv*v/(4*h*s))*exp(-1/r/c);
}
printf("tf=%f",tf[i][j]);
printf(" t=%f",t[i][j]);
}