What is Operators? Different types of Operators Used in C++ Language

Spread the love
What is Operators? Different types of Operators Used in C++ Language

Type operator (cast operator)

The word cast is used in the sense of “casting int a mold”. The compiler will automatically change one type of data into another field if it makes sense. For instance, if you assign an integer value to a floating- point variables.  The compiler will secretly call a function to convert the ‘int’ to a ‘float.

Arithmetic operators

Arithmetic operators are used for arithmetic likes addition, subtraction, multiplication division etc. These are mainly five arithmetic operator used in c++ language.
modules(remainder after division)
For examples, suppose a and b are two variables, then arithmetic operators used for different operations are:-]
A*b, a/b, a%b, a+b, a-b

Relations Operators

These create relationship between two operators. Relational operators are used for comparison purpose. The expressions have two operands and one relation operator is called relational expression. These are mainly six relational operators used in c++ language.

These are listed as in the below table:-

Relational Operators
 Less then
Less then equal to
Greater then
Greater then equal to

Equal to
Not equal to
These operators are used in if statement,switch statement,conditional operation statement, while statement, do-while statement and for statement.

Logical operators

Logical operators are used logical operations. The operation  are used for compound relational expression. when more then one relational expression occur in a c++ expression, using logical operation, then these are called compound relational expression. These are used in decision making statement and some looping statement like if, switch, do-while, while and for etc.

There are mainly there logical operations as listed in the table below:-

Logical operator
Logical AND
Logical OR
Logical NOT
For example:-
And Logical operator
If (a>b&&a>c)
Cout<< “n A is greatest number”;
Using Or operator:-
If(roll no.==112||sex== ‘M’)
Cout<< “n ABSENT”;

Assignment operator

Assignment is performed with the operator. It means “take the right hand side and copy it into the left-hand side”. The value any constant variable or expressions that can produce a value. But 1 value must be a district named variable. For instance, you can assign a constant value to a variable (A=4;), but you cannot assign anything to constant value i.e. it can’t be an 1 value(4=A;).
Assignment operators are used for assigning an expression or value to a variable.
Assignment operators are of two types:-

Simple assignment operator

4.    Conditional operator:-
Conditional operators are also called as ?: operators. These operators are used replacement of if statement.
The general syntax conditional operators is as:-

Exp.1? exp2: exp3;
a=10; b=5;
The above if statement can be written by using condition operators as :-

C=(a>b)? a-b: a+b;

5.    Bit-wise operators

The bit-wise operators allows you to manipulate individual bits in a number. Bit-wise operators perform Boolean algebra on the corresponding bits in the arguments to produce the result . These are used for the manipulation of binary data(bit).
There table for bit wise operator is a :-

Bit-wise operator
Bitwise AND
|(pipe symbol)

Bitwise OR
Bitwise X-OR
Bitwise Left
Bitwise Right
~ tilde
Bitwise Not
Design by Mohit Bhardwaj


Hello Visitors, myself Mohit Bhardwaj working in blogging sector since last 8 years. my qualification in bachelor degree in computer science steam. contact Number: 80910-51002

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Our Visitor

Users Today : 21
Users Yesterday : 29
Users Last 7 days : 231
Users Last 30 days : 1111
Users This Month : 488
Users This Year : 4267
Total Users : 8726
Views Today : 71
Views Yesterday : 37
Views Last 7 days : 399
Views Last 30 days : 1911
Views This Month : 805
Views This Year : 8695
Total views : 20154
Who's Online : 0
error: Content is protected !!