Page 24 - Modular_V1.1_Flipbook
P. 24
03 OPERATORS IN C++
Your Aim
to learn about:
Operators Operator Precedence
Expressions Type Casting
C++ is a versatile language that allows the user to perform various mathematical operations.
These operations can be performed with the help of operators. In this chapter, you will learn
about various types of operators provided by C++.
OPERATORS
As you know that an operator is a symbol used to perform mathematical and logical calculations.
C++ provides six types of operators, which are:
Arithmetic Operators Relational Operators
Logical Operators Assignment Operators
Increment and Decrement Operators Ternary Operator
Arithmetic Operators
Arithmetic operators are general mathematical operators used to perform arithmetic operations.
These operators work on two operands. Hence, these operators are called binary operators. C++
provides the following arithmetic operators:
Operator Name Description Example Output
(a = 11, b = 4)
+ Addition Adds two operands. a + b 15
- Subtraction Subtracts the operand written on the a - b 7
right-hand side of the operator from
the operand written on the left side.
* Multiplication Multiplies both operands. a * b 44
/ Division Divides numerator by denominator. a / b 2
% Modulus Divides numerator by denominator a % b 3
and returns the remainder.
22 Touchpad MODULAR (Version 1.1)-X

