Jul 14, 2012 at 2:29pm UTC
I am making a small battleships game, and i keep getting the error "expected an expression" in this line:
while (comgameboard [9][9] != {'.'} && urboard [9][9] != {'.'})
|
in the spot where the line is. Please help
Last edited on Jul 14, 2012 at 2:30pm UTC
Jul 14, 2012 at 3:06pm UTC
When posting code, it is advised to use the code tags, which is the <> icon near the text field.
My guess is that you should substitute your braces for either parentheses or nothing.
ex:
while (comgameboard [9][9] != '.' && urboard [9][9] != '.' )
or
while (comgameboard [9][9] != ('.' ) && urboard [9][9] != ('.' ))
Last edited on Jul 14, 2012 at 3:07pm UTC
Jul 14, 2012 at 3:19pm UTC
The thing is, its a 9 by 9 array, and i need it to include the whole thing, and not just the bit which is 9,9 (coordinates). Will it still work like that if i do it the way you said?
Jul 14, 2012 at 3:26pm UTC
I'm not sure what exactly you mean, but the code I suggested should exit the loop once comgameboard[9][9] = '.' or urboard[9][9] = '.'