代码如下:
#define DX 0.005
#define DT 600
#define T0 1300
#define H 250
void main()
{
float cl(float x);
float kl(float x);
float arf(float x);
float a[27],b[27],c[27],f[27],t[27],u[27],v[27];
int i,j,k,l,p;
for(i=2;i<=26;i++)
{
t[i]=20;
}
for(i=2;i<=25;i++)
{
a[i]=1;
c[i]=1;
b[i]=-(DX*DX)/(2*DT)-2;
}
a[26]=2;
c[1]=-1;
b[26]=-(DX*DX)/(2*DT)-2;
for(p=1;t[1]<=1200;p++)
{
f[1]=DX*H/kl(t[1])*T0+DX*DX*t[1]/(2*arf(t[1])*DT);
for(j=2;j<=25;i++)
{
f[i]=-DX*DX*t[i]/arf(t[i]);
}
b[1]=DX*DX*t[26]/(arf(t[26])*DT);
f[26]=-DX*DX*t[26]/(arf(t[26]*DT));
u[1]=(-c[1])/b[1];
v[1]=f[1]/b[1];
for(k=2;k<=26;k++)
{
u[i]=(-c[i])/(a[i]*u[i-1]+b[i]);
v[i]=(f[i]-a[i]*v[i-1])/(a[i]*u[i-1]+b[i]);
}
t[26]=(f[26]-a[26]*v[25])/(a[26]*u[25]+b[26]);
for(l=25;l>=1;i--)
{
t[i]=u[i]*t[i+1]+v[i];
}
}
printf("the time that need is:%d",p);
}
float kl(float x)
{
float n;
if(x>=20 && x<=100)
n=60-5*(x-20)/80;
else if(x>100 && x<=200)
n=55-4*(x-100)/100;
else if(x>200 && x<=300)
n=51-5*(x-200)/100;
else if(x>300 && x<=400)
n=46-5*(x-300)/100;
else if(x>400 && x<=500)
n=41-4*(x-400)/100;
else if(x>500 && x<=600)
n=37-3*(x-500)/100;
else if(x>600 && x<=700)
n=34-4*(x-600)/100;
else if(x>700 && x<=800)
n=30-2*(x-700)/100;
else if(x>800 && x<=1000)
n=28;
else if(x>1000 && x<=1100)
n=28-(x-1000)/100;
else if(x>1100 && x<=1300)
n=27;
return n;
}
float cl(float x)
{
float n;
if(x>=20 && x<=100)
n=485+17*(x-20)/80;
else if(x>100 && x<=200)
n=502+16*(x-100)/100;
else if(x>200 && x<=300)
n=518+17*(x-200)/100;
else if(x>300 && x<=400)
n=535+25*(x-300)/100;
else if(x>400 && x<=500)
n=560+34*(x-400)/100;
else if(x>500 && x<=600)
n=694-4*(x-500)/100;
else if(x>600 && x<=700)
n=690-(x-600)/100;
else if(x>700 && x<=800)
n=689-3*(x-700)/100;
else if(x>800 && x<=900)
n=686+2*(x-800)/100;
else if(x>900 && x<=1300)
n=698;
return n;
}
float arf(float x)
{
int e,midu=7800;
e=k(x)/(midu*c(x));
return e;
}
得到的编译结果如下:
FENG.OBJ : error LNK2001: unresolved external symbol _c
FENG.OBJ : error LNK2001: unresolved external symbol _k
Debug/FENG.exe : fatal error LNK1120: 2 unresolved externals
执行 link.exe 时出错.
不知道为什么出现这个结果?这个程序的代码很简单呀!为什么出现这个结果!纳闷了!
奇怪的编译问题!