Opperand Error in If statements

so I'm writing a program to check sudoku puzzles as you solve them, so if you put a number in a spot where it is already in the row, column, or square, it will not let you. So I'm using a 2d string with 9 characters in each dimension.

Now, to get to the part that I'm having trouble.
1
2
3
4
5
6
7
8
9
10
11
void delete_number ( int x_coor, int y_coor, string puzzle_grid[][SIZE] )
{
	if ( puzzle_grid[x_coor][y_coor] != ' ' )
	{
		puzzle_grid[x_coor][y_coor] = ' ';
		number_of_blanks++;
	}

	else
		cout << "Cannot delete spaces" << endl;
}


That section of code is to check a spot for a number, and if there is a symbol other then a space there, it will delete it. Now the error.

Error 1 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) c:\users\shawn\documents\sudoku_puzzle_checker.cpp 175

it does this error for all '==' and '!=' that involve characters. I'm not sure of the problem, I'm new to this, so hopefully you can give me some input. This is due in two days, wednesday, so please help as soon as possible.
use " instead of ' like line 3: if ( puzzle_grid[x_coor][y_coor] != " " ).

Why do you use string? Seems that a simple char would suffice (then you could use ' again)
Ahh, that makes sense, thank you. I'll probably switch to characters
Topic archived. No new replies allowed.