Shortend operator

 

It is combination of arithmetic operator and assignment operator.

 

There are five shortend operators:

Let value of a is 12….

Shortend operator

Without Shortend operator

With Shortend operator

Output

 

 

 

 

+=

a=a+5

a+=5

17

-=

a=a-5

a-=5

7

*=

a=a*5

a*=5

60

/=

a=a/5

a/=5

2.4

%=

a=a%5

a%=5

2

 

 

Unary operator

 So far we have been dealing with binary operator an operator which has two operand is called binary operator. and the operator which has only one operand is called unary operator.

 

 there are two unary operator :-

i)                    Increment operator (++)

ii)                   Decrement operators(--)

 

i)      Increment operator :- this operator increase the value of variable by 1 .

 

ii)   decrement operator:- this decrease the value of variable by 1.

 

Syntax:

 

a=10;

a++;

cout<<a;--------Γ 11

a=20;

a--;

cout<<a;--------Γ 19

 

 

Note :

It means the value of variable can be changed either using assignment operator or using unary operator.

 

 types of increment and decrement operator:-

i)  Prefix

ii) postfix


πŸ‘‰  IF you want to know how to display any string or anything in C++ then   CLICK HERE
 
       πŸ‘‰ IF you want to know How to solve Complex type of mathematical Problem in C++ 

               Programming  CLICK HERE

πŸ‘‰ IF you want to know How to calculate percentage  in C++ Programming  CLICK HERE

πŸ‘‰ IF you want to know How to use mathematical  operator in c++     CLICK HERE 


Our website: 


  πŸ˜‡ https://codemasternisha.blogspot.com/πŸ˜‡



if you face any any problem or any issue about our website then fill the contact us page and write your issues in it ...

πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡



                      KEEP SUPPORTING πŸ‘Œ !!  KEEP LEARNING πŸ“š !!



                                                                    πŸ˜‡πŸ˜‡πŸ˜‡πŸ˜‡πŸ˜‡πŸ˜‡πŸ˜‡