Logical Operator - Learn C++ Programming language

 

Logical Operator -  Learn C++ Programming language

Logical Operator:

  • You have tried iffy to check the two or more related conditions.
  • But in practice, you may want to check much more complex conditions.
  • For instance, you could be searching a personnel file for someone who is older than 21, younger than 35, is female, has a bachelor’s or master’s degree, is unmarried, and speaks Hindi or Urdu.
  • The logical operators provide a neat and simple solution. 
  • Using logical operators, you can combine a series of comparisons into a single expression so that you need just one if, almost regardless of the complexity of the set of conditions.

Symbols of Logical Operator

  • The first two, && and ||, are binary operators.
  • The third operator, !, is unary.
 A bank gives loan in two situations 
1. If customer’s age is more than 25 and his salary is more than 25000 
2. If customer’s age is less than 25 and his income is 20000


Post a Comment

0 Comments