Code:
char column2;
char row2;
do
{
do
{
cout << " \nEnter column: C- ";
cin >> column2;
cin.ignore(80,'\n');
column=atoi(column2);
} while(column > 7); // column should be an int, not a char, so dont compare to a char
do
{
cout << "\nEnter Row R- ";
cin>> row2;
cin.ignore(80,'\n');
row=atoi(row2);
} while(row > 7); //same with row. compare it to an int, not a char
if(board[row][column] == 'X')
{
piecevalid++;
}else{
cout << " \nPlease select a valid piece\n";
}
} while(piecevalid != 1);
your code was not behaving correctly, because you were comparing an int, to the ascii value of the char '7' instead of comparing to 7