Save
CSC 2.2 S2
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Kipasss
Visit profile
Cards (28)
Operators in C++ can be classified into 6 types: 1. Arithmetic Operators 2. Assignment Operators 3. Relational Operators 4. Logical Operators 5.
Compound
Operators 6. Increment & Decrement Operators
Operator :
+
Operation :
addition
Operator :
-
Operation :
substraction
Operator :
*
Operation : multiplication
Operator :
/
Operation : division
Operator :
%
Operation :
Modula
operation
Operator :
a
=
b
; Equivalent to : a=b;
Operator :
a
+
=
b;
Equivalent to : a = a + b;
Operator :
a
-=
b
; Equivalent to : a = a - b;
Operator :
a
*
=
b
; Equivalent to : a = a * b;
Operator :
a
/
=
b
; Equivalent to : a = a / b;
Operator :
a
%
=
b
;
Equivalent
to : a = a % b;
Operator
:
=
=
Meaning : equal to
Example 3 == 5 is 0
Operator :
!
=
Meaning : not equal to
Example : 3 != 5 is 1
Operator :
>
Meaning : greater than Example : 3 > 5 is 0
Operator :
<
Meaning
: less than Example : 3 < 5 is 1
Operator :
>
=
Meaning : greater than or equal to Example : 3 >= 5 is 0
Operator :
<
=
Meaning :
less than
or
equal
to Example : 3 <= 5 is 1
Operator :
&&
Meaning : true if
all
the operands are true
Example : expression 1 && expression 2 is 1
Operator :
|
|
Meaning : true if at least
one
operands is true
Example : expression 1 || expression 2 is 0
Operator :
!
Meaning : true if only operands is
false
Example : !expression is 1
Operator :
price
*= units + 1
Equivalent :
price
=
price
*
(
units+1
)
Every statement must end with
semicolon
(
;
)
Terminate with
return
0;
0
is false
1
is true
Arithmetic
Operators
Addition ,
+
Substraction,
-
Multiplication,
*
Division,
/
Modula Operation,
%
Assignment
Operators
a = b;
a
+
= b; additional
a -= b; substraction
a
*
= b; multiplication
a
/
= b; division
a
%
= b; Modula operation
Relational
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,
!