Main menu

Pages

C++ operations - Learn CPP, Boolean operations in c++ are used for comparison operations and have special symbols


  • && means (and).
  • icon || It means (or).
  • Code! It means denial.


C++ operations - Learn CPP


Before we start with the operations, several things should be noted


  • Any boolean operation in C++ has a result of either 0 or 1.
  • Any number other than zero, whether negative or positive, expresses one.
  • The number one is true and the number zero is false.
  • Most of the use of logic gates is in the condition clause if we want to check one or two conditions.


First: the operation “&&” (and):


gate table and:


  • one and zero = zero.
  • Zero and one = zero.
  • Zero and zero = zero.
  • one and one = one.


Here the program will do between 0 and 1 and the result will be 0


Second: Operation “or” (||):


The (or) operation is done through the symbol ||.


Gate or table:


  • one or zero = one.
  • Zero or one = one.
  • Zero or zero = zero.
  • one or one = one.


Here the program does an or between 0 and 1 and the output is 1.


Third: the process “negation” (not):


This attic is done through the code!. Any value other than zero is the number one i.e. true, here the program will find the negation of one i.e. zero, that is, the result of zero will be (false).


Gate table not:


  • Zero = one.
  • one = zero.