Hi, what does this mean in c++?

sum += c

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.

It's functionally equivalent to sum = sum + c .

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.

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.