Compound Assignment Operators in C++

Compound Assignment Operators in C++

Let us see the Compound Assignment Operators in C++.

Operators What the operators will do?
<<= Shift the value of the 1st operand left the number of bits specified by the value of the 2nd operand and then store the result in the Variable specified by the 1st operand.
%= Variable specified by the 1st operand  = Take modulus of the 1st operand specified by the value of the 2nd operand
^= Obtain the bitwise exclusive OR of the 1st and 2nd operands; store the result in the Variable specified by the 1st operand.
|= Obtain the bitwise inclusive OR of the 1st and 2nd operands; store the result in the Variable specified by the 1st operand.
&= It can take the bitwise AND of the 1st value and the 2nd operands value and then store the result in the Variable that can be specified by the 1st operand.
+= Variable specified by the 1st operand = value of the 2nd operand + value of the 1st operand
–= Variable specified by the 1st operand = value of the 2nd operand  – value of the 1st operand.
>>= Shift the value of the 1st operand right the number of bits specified by the value of the 2nd operand; store the result in the Variable specified by the 1st operand.
* = Variable specified by the 1st operand = value of the 1st operand  *  value of the 2nd operand
/= Variable specified by the 1st operand = 1st operand / value of the 2nd operand

Compound Assignment Operators in C++ using For Loop

Let’s see the program of “Compound Assignment Operators in C++ using For Loop”.

Compound Assignment Operators in C++ using While Loop

Let’s see the program of “Compound Assignment Operators in C++ using While Loop”.

Compound Assignment Operators in C++ using the Array

Let’s see the program of “Compound Assignment Operators in C++ using the Array”.

Compound Assignment Operators in C++ using the User Define Functions

Let’s see the program of “Compound Assignment Operators in C++ using the User Define Functions”.

 

Latest posts by Prof. Fazal Rehman Shamil (see all)

Buy advertisement space on T4Tutorials

For more details email [email protected]