明明看起来没问题,但运行的时候就是出这个错误,一直在网上找了很久都没答案
以下是代码
#include
using namespace std;
#include
#define m 8
#define n 7
char X[m]={'0','A','B','C','B','D','A','B'};
char Y[n]={'0','B','D','C','A','B','A'};
int Structure Sequence(int B[a][b],int a,int b)
{
int i=a;
int j=b;
if(i==0||j==0)
return 0;
else if(B[i][j]==0)
{
cout<<"X[i]"<<" ";
Structure Sequence(B,i-1,j-1);
}
else if(B[i][j]==1)
{
Structure Sequence(B,i-1,j);
}
else
Structure Sequence(B,i,j-1);
}
int main()
{
int i,j;
int C[m][n]={0};
int B[m][n]={0};
for(i=0;iC[i][0]=0;
for(j=0;jC[0][j]=0;
cout<<"标记函数B[i][j]:"<1;i1;jX[i]==Y[j])
{
C[i][j]=C[i-1][j-1]+1;
cout<<"B["<"]["<"]="<<"↖"<<" ";
B[i][j]=0;
}
else if(C[i-1][j]>=C[i][j-1])
{
C[i][j]=C[i-1][j];
cout<<"B["<"]["<"]="<<"↑"<<" ";
B[i][j]=1;
}
else
{
C[i][j]=C[i][j-1];
cout<<"B["<"]["<"]="<<"←"<<" ";
B[i][j]=-1;
}
}
cout<"优化函数C[i][j]:"<0;i0;j"C["<"]["<"]="<<C[i][j]<<" ";
}
cout<Structure Sequence(B,i,j);
return 0;
}
编译的时候一直出这个错误
[Error] expected initializer before 'Sequence'
求大家教一下
Structure干啥的呢?
抱歉没注意,函数名不能有空格