Question & Answer
Q&A is closed
This is an old revision of the document!
To edit the value of a variable, you use the mathematical operators +, -, /, and *. Let's create the variable jimmy and set it to nine :
int jimmy = 9;
If we want jimmy to to set to 10 we can do the following:
jimmy = jimmy + 1;
Remember this syntax: [the varaible that you want to change] = [the number or existing varaible] ;
jimmy is the variable you want to change (to ten) and
jimmy + 1 is the value that exists. Merely typing
jimmy + 1 does not set the value of jimmy to 10 because to change the value of something, you must have the equal sign. It is used the same way in C++ as in mathematicals.
variable = variable + x is repetitive and annoying, the creator (all hail Bjarne Stroustrup) made