OPERATORS
Operators are symbols that execute a corresponding action during the program. In C++ there are several categories of operators each having a unique feature. Below are the commonly known categories of operators.
o Assignment Operators
o Mathematical Operators
o Increment and Decrement Operators
o Relational Operators
O Logical Operators
ASSIGNMENT OPERATORS (=, += , -= , *= , /= , %=)
Ex. A= b+c;
Assigning A as with the sum of b and c.
The operand that holds the value is found on the left side of the assignment statement operator while the assigned values were found on the right side.
MATHEMATICAL OPERATORS (+, - , *, /, %)
+ for addition
- for subtraction
* for multiplication
/ for division
% for yielding the remainder
INCREMENT (++) AND DECREMENT OPERATORS (--)
The operators increase and decrease the original values assigned to them by 1.
Simply put a++; will yield an equivalent result to a=a+1; similarly, a--; is the same as a=a-1.
RELATIONAL OPERATIONS (==, !=, >,<,>=,<=)
== EQUAL
!= NOT EQUAL
> GREATER THAN
< LESS THAN
>= GREATER THAN OR EQUAL
<= LESS THAN OR EQUAL
LOGICAL OPERATIONS ( &&, ||, !)
TRUTH TABLE OF && (AND), || (OR), and !(NOT)
AND (&&) OR (||) NOT (!)
X Y RESULT X Y RESULT X RESULT
T T T T T T T F
T F F T F T F T
F T F F T T
F F F F F F