·  C++ – Syntax – Operators – Logical

 

- Info:

  - This tutorial shows how to use Conditional Operators in C++.: && || !.

  - They are used to create complex logical structures from individual Comparison Operations.

 

- Example:

  - Create C++ Console Application Test.cpp.

 

    Test.cpp

    #include <stdio.h>

   

    int main () {

   

      char left  = 65;

      long right = 70;

   

      if ( left >  50 && right == 70 ) { printf("left >50 AND right==10   \n"); }

      if ( left !=  4 || right >  90 ) { printf("left!=50 OR  right> 90   \n"); }

      if (            !  (left == 80)) { printf("left is  NOT equal to 80 \n"); }

   

      return 1;

   

    }