Hi

I have come accross this in my programming book...

This is probably very easy but i have no idea what it is.Code:`+=`

Thanks in advance.

Printable View

- 04-17-2007beeneassignment operator... i think
Hi

I have come accross this in my programming book...

Code:`+=`

Thanks in advance. - 04-17-2007h3ro
It takes the value you have and adds something to it.

Its the same as doing:

int a = 10;

a= a+ 4; - 04-17-2007beene
Thanks

- 04-17-2007robatino
There's a good chance that the index of your book lists these symbols before "A".

- 04-17-2007CornedBee
Basically, C++ has quite a few "composite assignment" operators of the form op=, where op is any of [+, -, *, /, %, &, |, ~, <<, >>] and perhaps more that I forgot. They all are defined such that

expr1 op= expr2

is equivalent to

expr1 = expr1 op expr2

except that expr1 is evaluated only once.