帮帮忙吧,初学者,可这个程序总也编译不了
#include <stack>
#include <iostream>
using namespace std;
#define M 10
stack <int> stack1,stack2;
int way[M+6][M+31]=
{
{'0','0','1','1','1','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},
{'1','0','1','0','0','0','0','0','1','1','1','1','1','1','1','1','1','1','1','1','1','1','0','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},
{'0','0','1','0','1','0','1','1','1','1','1','1','1','1','1','0','1','1','1','1','1','1','0','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},
{'0','0','0','0','1','0','1','1','1','1','1','1','1','1','1','0','1','1','1','1','1','1','0','1','1','1','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1'},
{'1','1','1','0','1','0','1','1','1','1','1','1','1','1','1','0','1','1','1','1','1','1','0','1','1','1','0','1','1','1','1','1','1','1','1','1','1','1','1','0','1'},
{'1','1','0','0','1','0','1','1','1','1','1','1','1','1','1','0','1','1','1','1','1','1','0','1','1','1','0','1','1','1','1','1','1','1','1','1','1','1','1','0','5'}
};
int judge(int line,int col)
{
if (line==5)
{
return 1;
}
else
{
cout<<"ok"<<endl;
if(!((line==M)&&(col==M)))
{
cout<<line<<endl;
cout<<col<<endl;
cout<<M<<endl;
if((way[line][col+1]==0)&&([col+1<31]))
{
cout<<"ok2"<<endl;
col++;
stack1.push(line);
stack2.push(col);
judge(line,col);
}
else
{
if((way[line+1][col]==0)&&([line+1<6]))
{
cout<<"ok3"<<endl;
line++;
stack1.push(line);
stack2.push(col);
judge(line,col);
}
else if
{
((way[line][col-1]==0)&&([col-1>-1]))
{
cout<<"ok4"<<endl;
col--;
stack1.push(line);
stack2.push(col);
judge(line,col);
}
else if
{
((way[line-1][col]==0)&&(line-1>-1))
{
cout<<"ok5"<<endl;
line--;
stack1.push(line);
stack2.push(col);
judge(line,col);
}
else
{
cout<<"ok6"<<endl;
line=stack1.top();
col=stack2.top();
stack1.pop();
stack2.pop();
judge(line,col);
}
}
}
}
}
}
}
void print()
int main()
{
int line,col;
int judge;
cout<<"please insert the line colum "<<endl;
cin>>line,col;
judge(line,col);
return 0;
}
return 0;
}
}
line 37 error: expected primary-expression before '[' token
line 48 error:expected primary-expression before '['
line 59 error: expected '(' before '{' token
line 123 error: expected '}' at end of input
line 123 error: expected '}' at end of input
line 123 error: expected '}' at end of input
line 123 error: expected '}' at end of input