0 votes
in C Plus Plus by
What are the various Compound Assignment Operators in C++?

1 Answer

0 votes
by
Following are the Compound assignation operators in C++:

+=, -=, *=, /=, %=, >>=, <<=, &=, ^=,|=

Compound assignation operator is one of the most  important features of C++ language which allow us to change the value of a variable with one of the basic operators:

Example:

value += increase; is equivalent to value = value + increase;

if base_salary is a variable of type int.

               int base_salary = 1000;

               base_salary += 1000; #base_salary = base_salary + 1000

               base_salary *= 5; #base_salary = base_salary * 5;

Related questions

0 votes
asked Jun 11, 2020 in C Plus Plus by Robindeniel
0 votes
asked Jun 15, 2020 in C Plus Plus by Robindeniel
...