求大神解答:missing ';' before 'constant'
编码时总是出现error C2143: syntax error : missing ';' before 'constant',不太懂,新手小白,求论坛大神多多指点,谢谢啦!下面是代码:#include<iostream.h> double interpl(int t,double u);
#include<math.h> void main()
#include<stdio.h> {
#include<stdlib.h> int ml=100;
const L=50000; double r=0.95;
const m=4; double stepfactor=0.002;
const n=40; double T=100;
const h=1000; double q[8],x0[2*m],x2[2*m];
const 1=L/h+1;(这里总是显示missing ';' before 'constant',求解答) double array[8];
double function(double[]); int i,j,k;
double raman_gain(double fP,double fS); double y1,y2;
double p[8][2*m]={{1423,1446,1458,1500,2887,3643,3910,13524},{1424,1440,1458,1496,3000,3643,3910,13520},{1424,1440,1460,1480,2900,3645,3920,12000},{1424,1444,1464,1486,3000,3650,4000,12000},{1425,1445,1460,1495,2887,3643,3906,13254},{1425,1448,1456,1494,3100,3710,3950,13500},{1426,1448,1468,1488,2880,3500,3890,12900},{1426,1448,1470,1490,2980,3700,4000,13670}};
double c; { for(j=0;j<2*m;j++)
int a=0; array[j]=p[i][j];
double a1,a2; q[i]=function(array);}
do{for(i=0;i<8;i++)
double ma=(q[0]+q[1]+q[2]+q[3]+q[4]+q[5]+q[6]+q[7])/8;
for(i=0;i<7;i++)
{ if((q[i]-ma)*(q[i+1]-ma)<0{ for(j=0;j<2*m;j++){
y1=p[i][j]; y2=p[i+1][j]; p[i][j]=0.9*y1+0.1*y2; p[i+1][j]=0.9*y2+0.1*y1;
}}
else if((q[i]-ma>0)
{ for(j=0;j<2*m;j++) p[i][j]=p[i][j]*(1+0.004*((rand()/(double)RAND_MAX-0.5));}}
if((q[7]-ma)>0)
{ for(j=0;j<2*m;j++) p[7][j]=p[7][j]*(1+stepfactor*((rand()/(double)RAND_MAX)-0.5));}
for(i=0;i<8;i++) { if(q[i]<b)
{for(fj=0;j<2*m;j++) {for(j=0;j<8;j++)
array[j]=p[i][j]; {x0[j]=p[i][j];}
q[i]=function(array);} b=q[i];
double b=q[0]; d=i;}}
int d=0; for(j=0;j<8;j++)
for(i=0;i<8;i++) {p[d][j]=0;}
c=b;
for(i=0;i<m1;i++)
{ for(j=0;j<8;j++)
x2[j]=x0[j]*(1+stepfactor*((rand()/(double)RAND_MAX)-0.5));
a1=function(x0); a2=function(x2);
if(a2<a1)
{ for(k=0;k<8;k++) x0[k]=x2[k];
c=a2; i=m1;}
else
{ if(exp(-(a2-a1)/T)>(rand()/(double)RAND_MAX))
{ for(k=0;k<8;k++)
x0[k]=x2[k];}}
cout<<c<<'\n';
a++;
cout<<a<<'\n';}
T=T*r;
for(i=0;i<8;i++)
cout<<x0[i]<<'\n';
for(i=0;i<8;i++)
{ for(j=0;j<2*m;j++)
{ if(p[i][j]!=0)
j=2*m;
else{ p[i][j]=x0[j];}}}
}while(c>0.025);
return;}
double function(double p[])
{ int i,j; double F[n],S[m],Slamda[n],fS[n],fP[m];
for(i=0;i<n;i++)
{ Slamda[i]=1530+i*2; fS[i]=3e17/Slamda[i];}
for(i=0;i<m;i++)
{ fP[i]=3e8/p[i]/1e-9; S[i]=p[i+m];}
double gPS[m][n];
for(i=0;i<m;i++)
{ for(j=0;j<m;j++) gPS[i][j]=raman_gain(fP[i],fS[j])/50e-12/2;}
for(i=0;i<n;i++)
{ double k=0;
for(j=0;j<m;j++) k=k+4.343*gPS[j][i]*S[j];
F[i]=(fabs(k-20))/20;}
double a=0;
for(i=0;i<n;i++)
{ if(F[i]>a)
a=F[i];}
erturn(a);}
#include<iostream.h> const n=40;
#include<math.h> const h=1000;
#include<stdio.h> const 1=L/h+1;
#include<stdlib.h> double gain(double[]);
const L=50000; double raman_gain(double fP,double fS);
const m=4; double interp1(int t,double u);
void main()
{ int m1=500; double T=100;
double r=0.95; double x2[m],a1,a2;
double stenfactor=0.005; int i,j,k;
double p[m]={0.749729,0.400612,0.30765,0.332938}; double c=gain(p);
do{ for(i=0;i<m1;i++)
x2[j]=p[j]*(1+stepfactor*((rand()/(double)RAND_MAX)-0.5));
a1=gain(p); a2=gain(x2);
if(a2<a1)
{ for(k=0;k<m;k++) p[k]=x2[k];
c=a2; i=m1;}
else{
if(exp(-(a2-a1)/T)>(rand()/(double)RAND_MAX))
{ for(k=0;k<m;k++) p[k]=x2[k];}}
cout<<c<<'\n';}
for(i=0;i<m;i++) cout<<p[i];
T=T*r;} while(c>0.025);
return;}
double gain(double p[])
{ int i,j,k,r,t; double fP[m],fS[n],d[n],GSdb[n],psz0[n],alphaS[n],Slanmda[n],alphaP[m];
for(i=0;i<n;i++)
{
alphaS[i]=0.2*1e-3/4.34; fS[i]=3e8/Slamda[i];
Slamda[i]=(1530+i*2)*1e-9; psz0[i]0.1*1e-3;
}
double Plamda[m]={1425.68,1447.67,1461.81,1492.25};
for(i=0;i<m;i++)
{ alphaP[i]=0.3*1e-3/4.34; fP[i]=3e8/Plamda[i]/1e-9;}
double psz[n][l],ppz[m][l],temp_ppz[m][l,temp_psz[n][l],pf[n][l],pb[m][l];
for(i=0;i<n;i++)
{ for(j=0;j<1;j++){ for(i=0;i<m;i++)
psz[i][j]=psz0[i]*exp(-alphaS[i]*j*h); {for(j=0;j<1;j++)
temp_psz[i][j]=psz[i][j]; {ppz[i][j]=p0[i]*exp(alphaP[i]*(j*h-L));
pf[i][j]=psz[i][j];} temp_ppz[i][j]=ppz[i][j];
d[i]=psz[i][l-1]; } pb[i][j]=ppz[i][j];}
double gPP[m][m],gPS[m][n],gSS[n][n];
for(i=0;i<m;i++)
{ for(j=0;j<n;j++)
{ if(j<m&&j>i)
gPP[i][j]=raman_gain(fP[i],fP[j])/50e-12/2;
gPS[i][j]=raman_gain(fP[i],fS[j])/50e-12/2;
for(k=j+1;k<n;k++)
gSS[j][k]=raman_gain(fS[j],fS[k])/50e-12/2;}}
double c=1;
double a,b,y,sump,sums;
int cishu=0;
while(c>1e-3)
{ y=0;
for(i=l-1;i>0;i--)
{ for(j=0;j<m;j++)
{sums=0; double sump1=0; double sump2=0;
for(k=0;k<n;k++) sums+=gPS[j][k]*psz[k][i]*fP[j]/fS[k];
for(r=0;r<j;r++) sump1+=gPP[r][j]*temp_ppz[r][i];
for(t=j+1;t<m;t++)sump2+=gPP[j][t]*ppz[t][i]*fP[j]/fP[t];
temp_ppz[j][i-1]=pb[j][i]*(-exp((-alphaP[j]-sums-sump2+sump1)*h)+1)/((alphaP[j]+sums+sump2-sump1)*h);
pb[j][i-1]=pb[j][i]*exp((-alphaP[j]-sums-sump2+sump1)*h);}
for(j=0;j<n;j++)
{ sump=0; double sums1=0; double sums2=0;
for(k=0;k<m;k++) sump+=gPS[k][j]*temp_ppz[k][i-1];
for(r=j+1;r<n;r++) sums1+=gSS[j][r]*psz[r][i]*fS[j]/fS[r];
for(t=0;t<j;t++)sums2+=gSS[t][j]*temp_psz[t][i];
temp_psz[j][i]=pf[j][i-1]*(exp((-alphaS[j]-sums1+sump+sums2)*h)-1)/((-alphaS[j]+sump+sums2-sums1)*h);
pf[j][i]=pf[j][i-1]*exp((-alphaS[j]-sums1+sump+sums2)*h);}}
for(j=l-1;j>=0;j--)
{ for(i=0;i<n;i++){
a=fabs(temp_psz[i][j]-psz[i][j]/psz[i][j]);
if(a>y) y=a;}
for(i=0;i<m;i++) {
b=fabs(temp_ppz[i][j]-ppz[i][j])/ppz[i][j];
if(b>y) y=b;}}
c=y;
for(j=l-1;j>=0;j++)
{ for(i=0;i<n;i++) psz[i][j]=temp_psz[i][j];
for(i+0;i<m;i++) ppz[i][j]=temp_ppz[i][j];}
++cishu;}
for(i=0;i<n;i++)
GSdb[i]=fabs(10*log10(psz[i][l-1]/d[i])-20);
double x1;
x1=GSdb[0];
for(i=0;i<n;i++)
{ if(GSdb[i]>x1)
x1=GSdb[i];}
return(x1);}