how do i make this work?
Jan 13, 2010 at 2:12pm
how do i make it so this compound if statement only executes if ALL the statements in the () are equal?
1 2 3 4 5 6
|
if ((space1 == "O"),(space2 == "O"),(space3 == "O"))
{
cout << "Computer wins" << endl;
win = true;
}
|
Last edited on Jan 13, 2010 at 2:13pm
Jan 13, 2010 at 2:15pm
take out the commas
and use the logical OR ||, or the logical AND &&
1 2 3 4 5
|
if ((space1 == "O") && (space2 == "O") && (space3 == "O"))
{
cout << "Computer wins" << endl;
win = true;
}
|
Last edited on Jan 13, 2010 at 2:17pm
Topic archived. No new replies allowed.