0% found this document useful (0 votes)
33 views13 pages

CC 104 - C+ + Operators

Operators in C++ are used to manipulate variables and values. There are several types of operators including assignment, arithmetic, modulo, increment/decrement, relational, and logical operators. Assignment operators assign values to variables. Arithmetic operators perform math operations like addition and subtraction. Relational operators check relationships between operands like greater than. Logical operators check if an expression is true or false.

Uploaded by

RicHArd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views13 pages

CC 104 - C+ + Operators

Operators in C++ are used to manipulate variables and values. There are several types of operators including assignment, arithmetic, modulo, increment/decrement, relational, and logical operators. Assignment operators assign values to variables. Arithmetic operators perform math operations like addition and subtraction. Relational operators check relationships between operands like greater than. Logical operators check if an expression is true or false.

Uploaded by

RicHArd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

CC 104 - C+

+
OPERATORS
OPERATORS

• Operators are used to manipulate variables and values in a program. C++ supports a
number of operators that are classified based on the type of operations they perform.
C++ ASSIGNMENT OPERATORS

• In C++, assignment operators are used to assign values to variables. (example above)
• Here, we have assigned a value of 5 to the variable a.
C++ ARITHMETIC OPERATORS

• Arithmetic operators are used to perform arithmetic operations on variables and data. 
• Here, the + operator is used to add two variables a and b. Similarly there are various other
arithmetic operators in C++.
MODULO

• The modulo operator % computes the remainder. When a = 9 is divided by b = 4, the


remainder is 1.
• Note: The % operator can only be used with integers.
INCREMENT AND DECREMENT
OPERATORS
• C++ also provides increment and decrement operators: ++ and -- respectively. ++ increases
the value of the operand by 1, while -- decreases it by 1.
 C++ RELATIONAL OPERATORS

• A relational operator is used to check the relationship between two operands.


• Here, > is a relational operator. It checks if a is greater than b or not.
• If the relation is true, it returns 1 whereas if the relation is false, it returns 0.
 C++ LOGICAL OPERATORS
• Logical operators are used to
check whether an expression
is true or false. If the
expression is true, it
returns 1 whereas if the
expression is false, it returns 0.

You might also like