lundi 5 juillet 2021

Can we two operator between 3 variables in C++

I want to compare four integers and see whether they are equal or not. So wrote the following,

    int a = 1, b = 2, c = 3, d = 4;
    if (a != b != c != d)
    {
        //do something
    }

This apparently shows no error. But, in fact, giving the wrong answer. Can someone explain this please?

Aucun commentaire:

Enregistrer un commentaire