Use And operator to connect two boolean expressions : relational and logical operators « Operators statements « C++ Tutorial






#include <iostream>

int main()
{
    int i1, i2;

    i1 = 4;
    i2 = 2;    

    if ((i1 != 0) && (i2 != 0))
        std::cout << "Both are not zero #1\n";

    return (0);
}
Both are not zero #1








3.2.relational and logical operators
3.2.1.The relational and logical operators
3.2.2.Use And operator to connect two boolean expressions
3.2.3.Logical operator keywords: and, or, not, not_eq
3.2.4.Create an XOR using the C++ logical operators.
3.2.5.Output the results of several variable comparisons.
3.2.6.A Demonstration of Branching Based on Relational Operators