how do i make this work?

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
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
Topic archived. No new replies allowed.