帮帮忙吧,初学者,可这个程序总也编译不了
#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
c++问题 : expected primary-expression before '[' token
\/\/修改编译错误的办法:\/\/所有提示expected primary-expression before '&' token;的地方 \/\/都把ArrayList&删掉 \/\/以及将i和j的赋值语句改为i=list1.elems;j=list2.elems;include include using namespace std;define INIT_SIZE 100 define INC_SIZE 10 \/\/定义一个线性表 typedef struct { int *...
C++ expected primary-expression before ')' token
括号错了 include<iostream> using namespace std;int main(){ int n,i,j,q;((n>=1)&&(n<=10));cin>>n;for(i=1;i<=n;i++){ for(j=1;j<=2*i-1;j++){ cout<<"*";} for(q=n-1;q>=1;q--){\/\/你把这个打成小括号了 cout<<" "<<endl;}\/\/你把这个打成小括号...
...expected primary-expression before '.' token
第一种通过FDEV_SETUP_STREAM宏来定义流: (C编译器)static FILE mystdout = FDEV_SETUP_STREAM(dev_putchar, NULL,_FDEV_SETUP_WRITE);ststatic FILE mystdin = FDEV_SETUP_STREAM(NULL,dev_getchar, _FDEV_SETUP_READ);stdout=&mystdout;stdin=&mystdin;dev_putchar,dev_getchar分别是负责...
c++求救 编程出现expected primary-expression before ']' token
show_array(arr[][3],Asize);应改为:fill_array(arr,Asize);show_array(arr,Asize);根据你的函数定义,在这里只能传递数组的地址,而不是整个数组
...expected primary-expression before ';' token ,错误类似这个,求原 ...
你的程序的主要问题是没有分清类和对象的区别,对于指针p是指向对象的,而不是指向类的 你的C++程序我帮你改完了,你看看吧(改动的地方见注释)include<iostream>using namespace std;class Firgure{protected: float x_size; float y_size;public: Firgure(float a,float b) {x_size=a;y_size=...
expected initializer before'\/'token是什么意思?
意思是:C++的语法错误。2、expected initializer before '<' token.意思是:借鉴里面问没有指定名字空间的问题,重新把boost库的路径放到了答程序的属性->c++编译器->包含目录里面。3、expected primary-expression before '.' token.意思是:用avr-gcc编译是可以通过的,但用avr-c++就出现上面错误...
c++ Error] expected primary-expression before '||' token
if( 0 == year % 400 || ( 0 == year %4 && 0 != year %100 ) )
C++ expected primary-expression before '.' token.
按照C++03,可以写成 struct test_struct testing = {10, 20};但最好是用前一条回答说的,用分离的语句指定各成员变量的值
C++,16 expected primary-expression before ')'token
include<stdlib.h> int main(){ int x;int y;int z;char t;cout<<"输入运算中第一个数";cin>>x;cout<<"输入运算中第二个数";cin>>y;cout<<"输入如何运算,加或减";cin>>t;\/\/if下面的两个语句都是属于if之中的,要用大括号哦 否则要有两个输出,这两个输出就没有限制了,都要...
c++编译出错,expected primary-expression before '=' token.
= =为什么用空格分开……