4
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by Fbody
0

That is the addition assignment operator... You are taking the value of c and adding it to the current value of sum. So if sum is 5 and c is 2 then after that operation sum will equal 7.

Edited by hag++: n/a

0

The C++ language has "compound" operators. The '+=' operator is used to increase the current value of the Left-Hand operand by the value of the Right-Hand operand.

Thus, the statements:

int a = 10;
a += 10;

Would cause an integer variable, called 'a', to be declared and initialized to (10), and subsequently be increased by (10) to a value of (20). It produces the same net result as:

int a = 10;
a = (a + 10);

EDIT:
Oops, Narue snuck in there.

Edited by Fbody: n/a

0

Oh okey thank you and it will be the same with any other operator right?

-1

oh okey thank you a lot. Also do you think you can help me understand what a palindrome is?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.