?
Solved

what does this symbol mean in c++

Posted on 2009-04-29
4
Medium Priority
?
663 Views
Last Modified: 2013-12-14
hi, i have come across some sample code and would just like to know what this means?

declared as
int f1=0

then
f1+=1

what is the += doing?

thanks in advance
0
Comment
Question by:kipl20
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
evilrix earned 2000 total points
ID: 24263877
The += mean add the value on the right to the variable on the left. In this case f1 will end up having a value of one after the += 1
0
 

Author Comment

by:kipl20
ID: 24263885
thanks sage
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24263898
All the important C++ operators, with good descriptions, can be found here
http://www.cplusplus.com/doc/tutorial/operators/
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24263902
short hand for

f1 = f1 + 1


In general, any operators of that form (+=, -=, /=, *= and %= and so forth are shorthand for)

x <operator>= y

are shorthand for

x = x <operator> y
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question