C++ divides the operators into the subsequent groups:

- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators

**Arithmetic Operators**

There are following arithmetic operators supported by C++ language −

Let Say, A = 10 and B = 20, then -

Let Say, A = 10 and B = 20, then -

Operators | Description | Example | Output |
---|---|---|---|

+ | Add Two Operands | A + B | 30 |

- | Substract Two Operands | A - B | -10 |

* | Multiplies Two Operands | A * B | 200 |

/ | Divides Two Operands | B / A | 2 |

% | Modulus Two Operands | B % A | 0 |

++ | Increase Value By One | A++ | 11 |

-- | Increase Value By One | A-- | 9 |

**Relational Operators**

There are following relational operators supported by C++ language −

Let Say, A = 10 and B = 20, then -

Let Say, A = 10 and B = 20, then -

Operators | Description | Example | Output |
---|---|---|---|

== | Checks if the values of two operands are equal or not.if the value are same then condition becomes true. | A == B | Not True |

!= | Checks if the values of two operands are equal or not.if the value are not same then condition becomes true | A == B | True |

> | Checks if the worth of left operand is bigger than the worth of right operand, if yes then condition becomes true. | A > B | Not True |

< | Checks if the worth of left operand is a smaller amount than the worth of right operand, if yes then condition becomes true | A < B | True |

>= | Checks if the worth of left operand is bigger than or adequate to the worth of right operand, if yes then condition becomes true. | A >= B | Not True |

<= | Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. | A <= B | True |

**Logical Operators**

There are following logical operators supported by C++ language.

Let Say, A = 1 and B = 0, then -

Let Say, A = 1 and B = 0, then -

Operators | Description | Example | Output |
---|---|---|---|

&& | Called Logical AND operator. If both the operands are non-zero, then condition becomes true. | A && B | False |

|| | Called Logical OR Operator. If any of the two operands is non-zero, then condition becomes true. | A || B | True |

! | Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true, then Logical NOT operator will make false. | !(A && B) | True |

**Bitwise Operators**

Bitwise operator works on bits and perform bit-by-bit operation.

The truth tables for &, |, and ^ are as follows −

The truth tables for &, |, and ^ are as follows −

p | q | p & q | p | q | p ^ q |
---|---|---|---|---|

0 | 0 | 0 | 0 | 0 |

0 | 1 | 0 | 1 | 1 |

1 | 1 | 1 | 1 | 0 |

1 | 0 | 0 | 1 | 1 |

ConversionConversion EmoticonEmoticon