lundi 30 juillet 2018

If statement executing when it shouldn't

Hello experienced programmers, here's the question for a non-experienced programmer.

Here's my code and some images explaining my issue.

void initialiseSystem(int status)
{
    if (status != '1' || status != '2')
    {
        std::cout << "Restart me, my wires got mixed up!" << std::endl;
        return;
    }
    std::cout << "I'm fully ready, I will wait until you will be ready.\nWhen you will be, please feel free to start chatting" << std::endl;
}

Here are the images, (full HD) https://imgur.com/a/3u6LI20.

I spent an hour starting at this if statement, and nothing. I rewritten it more than 50 times and nothing. This is a dumb problem, most likely... The if loop clearly states that if it's not equal to 1 OR not 2 then don't go there, it still goes ;(

Thank you for your help and time ;)

1 commentaire: