Need help with an "if" statement

closed account (i8bjz8AR)
delete
Last edited on
Have you read the tutorial on this site?
http://www.cplusplus.com/doc/tutorial/control/

Also, if you expect the user to enter 0 or 1, tell them that - right now you're telling them to enter something else completely.
closed account (i8bjz8AR)
delete
Last edited on
closed account (48T7M4Gy)
You can have a nested if to make sure the user input is valid.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int turn = 0;

cin >> turn;

if ( turn = ...|| ...)
{
     cout << " acceptable "
      if ( turn == 0  )
         // ...;
      else
         // ...
}
else
    cout << " unacceptable "
You don't need two variables H and T, you just need one variable to store the user input in.
Topic archived. No new replies allowed.