error: no match for operator

void InitializeGame(int dim)
{
// Initialize board memory
char board[8][8]= { {'r', 'n', 'b', 'k', 'q', 'b', 'n', 'r'},
{},{},{},{},{},{},
{'R', 'N', 'B', 'K', 'Q', 'B', 'N', 'R'} };
for(int row=1; row<=6; row++)
{
for(int col=0; col<=7; col++)
{
if( row==1)
{
cout<< board[row][col]='p' ;
}

else if ( row==6)
{
cout<< board[row][col]='P' ;
}
else
cout<< board[row][col]='-' ;
}
}
}
 
cout<< board[row][col]='p' ;

You're trying to assign an index and print the value at the same time. Do one or the other. Not both.
1
2
board[row][col]='p' ;
cout << board[row][col];
Topic archived. No new replies allowed.