You are on page 1of 6

C++ Operators

There are 4 C++ Operators


Arithmetic
Assignment
Comparison
Logical
Introduction to C++ Operators
•Operators are used to perform
operations on variable and values.
For example, + is an operator used
for addition, while – is an operator
used for subtraction.
Arithmetic Operators
Operator Name Description Example
+ Addition Adds together two
values
x+y
- Subtraction Subtracts one value
from another
x-y
* Multiplication Multiplies two values x*y
/ Division Divides one value by
another
x/y
% Modulus Returns the division
remainder
x%y
Assignment Operators
• = (Assignment)
• += (Addition Assignment)
• -= (Subtraction Assignment)
• *= (Multiplication Assignment)
• /= (Division Assignment)
• %= (Modulus Assignment)
Comparison Operators
• == (Equal to)
• != (Not equal to)
• > (Greater than)
• < (Less than)
• >= (Greater than or equal to)
• <= (Less than or equal to)
Logical Operators
• && (Logical AND)
• || (Logical OR)
• ! (Logical NOT)

You might also like