麻烦帮忙看看这个程序错误的原因,谢谢
#include<iostream.h>#include<math.h>
void lu(double w[6][502])
{
int t,k,i,j,min,max;
double s=0;
for(k=1;k<=501;k++)
{min=k+2;
if(k+2>=501)
min=501;
for(j=k;j<=min;j++)
{max=1;
if(k-2>=1&&k-2>=j-2)
max=k-2;
if(k-2>=1&&k-2<=j-2)
max=j-2;
for(t=max;t<=k-1;t++)
s=s+w[k-t+3][t]*w[t-j+3][j];
w[k-j+3][j]=w[k-j+3][j]-s;
s=0;
}
if(k>=501)
break;
min=k+2;
if(k+2>=501)
min=501;
for(i=k+1;i<=min;i++)
{max=1;
if(i-2>=1&&i-2>=k-2)
max=i-2;
if(i-2>=1&&i-2<=k-2)
max=k-2;
for(t=max;t<=k-1;t++)
s=s+w[i-t+3][t]*w[t-k+3][k];
w[i-k+3][k]=(w[i-k+3][k]-s)/w[3][k];
}
void main(){
double d[502];
double a[6][502];
double b=0.160;
double c=-0.064;
double m=0;
double x[1000];
double s=0;
double p=0;
int i,j;
for(i=1;i<=501;i++)
d[i]=(1.64-0.024*i)*sin(0.2*i)-0.64*exp(0.1/i);
for(j=3;j<=501;j++)
a[1][j]=c;
for(j=2;j<=501;j++)
a[2][j]=b;
for(j=1;j<=501;j++)
a[3][j]=d[j];
for(j=1;j<=500;j++)
a[4][j]=b;
for(j=1;j<=499;j++)
a[5][j]=c;
lu(a);
for(j=3;j<=501;j++)
cout<<a[1][j]<<endl;
for(j=2;j<=501;j++)
cout<<a[2][j]<<endl;
for(j=1;j<=501;j++)
cout<<a[3][j]<<endl;
for(j=1;j<=500;j++)
cout<<a[4][j]<<endl;
for(j=1;j<=499;j++)
cout<<a[5][j]<<endl;
}
错误显示为: 'main' : local function definitions are illegal
: fatal error C1004: unexpected end of file found
非常纳闷,麻烦高手指点一下,重谢