## Operators in C++

Hi this is Yuvraj from welearncode and welcome to the another C++ programming tutorial in this tutorial we will be discussing operators in C++ programming language and we will see some type of operators. In the previous tutorial you saw the concept of iteration or loops in C++.

In case of C++ it is a programming language which is rich with different operators which you can use in our coding. An operator in C++ is a symbol that tells the compiler to perform specific task such as mathematical or logical manipulation and C++ is rich in built-in operators.

These operators will be categorized mainly into these categories:

1. Arithmetic Operators

2. Relational Operators

3. Logical operators

4. Bitwise Operators

4. Assignment Operators

5. Misc Operators

**1. Arithmetic Operators:**In C++ we can see the arithmetic operators which are used to perform some basic operations for example the addition, the subtraction, multiplication, division and to do all these operations we have some operators and they are called arithmetic operators. We gonna see how to use them in a below program.

There are following arithmetic operators supported by C++ language:

If variable A holds 20 and variable B holds 10 then :

If variable A holds 20 and variable B holds 10 then :

**Example:**

So, here value of a is equal to 21 and the value of b is equal to 10 and c is variable of type integer which is uninitialized till now. Now whenever we doing a+b then c is getting the addition of a+b and the value of c is getting printed and addition of

Various C++ relational operators available are:

In the above program we have two variables namely a, b and value of a is initialize to 3 and the value of b is initialize to 2 after that we use

**21+10 is 31**. Now whenever we doing a-b then c is getting the subtraction of a-b and the value of c is getting printed and subtraction of**21-10 is 11**. Now the next one whenever we doing a*b then c is getting the multiplication of a*b and the value of c is printed and multiplication of**21*10 is 210**. Now whenever we doing a/b then c is getting the division of a*b and the c is getting printed and division of**21/10 is 2**. Now next we doing a%b that is, remainder of the division and the value of c is getting printed and modulus of**21%10 is 1**. Now we have the initial value of a is 21 and 21 have got increased and it is our post fix nation (a++) means ++ is occurring later so assignment will be done at first and then it will get increment and the value of c is printed i.e,**21**.**2. Relational Operators:**In C++ Programming, the values stored in two variables can be compared using following operators and relation between them can be determined. These operators are called relational operators.Various C++ relational operators available are:

**Example:**

**if statement**and give a condition i.e, if a is less than b then the statement**"a is less than b"**is printed on the screen and then we use**else if condition**i.e, a is more than b then the statement**"a is more than b"**is printed and after that we use one more**else if condition**i.e, a is double equal to b then the statement "**a is equal to b"**is printed on the screen.
## 0 Comments