error C2059: syntax error : 'bad suffix on number'怎么解决?
求助。自己写了个八皇后算法,编译的时候出错,C2059: syntax error : ’bad suffix on number’。
windows XP SP3,VC6.0.
代码如下:
#include<iostream.h>
#define N 8
static char q[N][N];
static int a[N];
static int b[2N-1];
static int c[2N-1];
int s,t;
for(s=0; s<N; s++){
a[s] = 0;
for(t = 0; t<N; t++)
q[s][t] = ’*’;
}
for(s=0; s<2N-1; s++){
b[s]=c[s]=0;
}
void queen(int n){
for(int i=n; i>=0; i--){
if(a==0 && b[N-n+i-1]==0 &&c[n+i-1]==0){
q[n] = ’Q’;
a = 1;
b[N-n+i-1] = 1;
c[n+i-1] = 1;
if(n-1>=0){
queen(n-1);
}else{
for(s=0;s<N;s++){
for(t=0;t<N;t++)
cout<<q[s][t]<<’ ’;
cout<<’\n’;
}
cout<<’\n’;
}
q[n] = ’*’;
a = 0;
b[N-n+i-1] = 0;
c[n+i-1] = 0;
}
}
}
错误如下: Compiling...
main.cpp
e:\program files\microsoft visual studio\myprojects\queen_081021\main.cpp(8) : error C2059: syntax error : ’bad suffix on number’
e:\program files\microsoft visual studio\myprojects\queen_081021\main.cpp(8) : error C2143: syntax error : missing ’]’ before ’constant’
e:\program files\microsoft visual studio\myprojects\queen_081021\main.cpp(8) : error C2143: syntax error : missing ’;’ before ’constant’
e:\program files\microsoft visual studio\myprojects\queen_081021\main.cpp(8) : fatal error C1004: unexpected end of file found