Operators in C++
C++ Operators
An operators are used to perform a mathematical operation on single or multiple operands. There are various operators available in C++, which are categorized into 5 parts-
Arithmetic Operators
Operator | Description |
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus (Remainder of a division) |
Assignment Operators
Operator | Description |
= | Assign |
+= | Add and assign |
-= | Subtract and assign |
*= | Multiply and assign |
/= | Divide and assign |
%= | Modulus and assign |
Comparison/Relational Operators
Operator | Description |
== | Equal to |
!= | Not equal to |
> | Greater than |
>= | Greater than or equal to |
< | Less than |
<= | Less than or equal to |
Boolean/Logical Operators
Operator | Description |
&& | Logical AND |
|| | Logical OR |
! | Logical NOT |
Increment and Decrement Operators
Operator | Description |
++ | Increment |
-- | Decrement |
Ternary Operators
Operator | Description |
(expression) ? true : false | Ternary operators |