Question: "or" operand for "do while" loop

I tried including an "or" operand in my do while loop

```
if(input2 == "1"){
    string input3;
    do {
        cout << "Which would you like to check?" << endl;
        cout << "1. Checking." << endl;
        cout << "2. Savings." << endl;
        cout << "3. Credit Card." << endl;
        cin >> input3;
            if(input3 != "1"||"2"||"3"){
            cout << "That is an invalid response. Please enter again." 
            <<endl;
            }
    } while(input3 != "1"||"2"||"3");
}

```

but it does not seem to be working. Even if I put either 1, 2 or 3, it still reads it as an invalid response. What am i doing wrong?

Answer: 
Actually there is a mistake in your condition.

The boolean || is used in a wrong way. If you want to check if `a`' is equal to `1` or `2` you should check it like this

`a == 1 || a == 2`

When you say `input3 != "1"||"2"||"3"` It will first evaluate `input3 != "1" || "2" || "3"`. This is will always evaluate to TRUE because anything that is not zero and can be converted to a boolean is not `false` in `C++`.

Modifying your code to use the correct comparisons .. 

```
if(input2 == "1"){
    string input3;
    do {
        cout << "Which would you like to check?" << endl;
        cout << "1. Checking." << endl;
        cout << "2. Savings." << endl;
        cout << "3. Credit Card." << endl;
        cin >> input3;
            if(input3 != "1" && input3 != "2" && input3 != "3"){
            cout << "That is an invalid response. Please enter again." 
            <<endl;
            }
    } while(input3 != "1" && input3 != "2" && input3 != "3");
}

```
This code:

```
input3 != "1"||"2"||"3"

```

means (input3 is not "1") or ("2") or ("3")

A string literal like "2" in C++ will evaluate to a boolean true when used in a boolean expression like this, so your expression will always be evaluated as true.

I think what you want is this:

```
input3 == "1" || input3 == "2" || input3 == "3"

```

meaning input3 is either "1", "2" or "3"

or

```
input3 != "1" && input3 != "2" && input3 != "3"

```

meaning input3 is neither of "1", "2" or "3"