remove 200 from int....

Hey.

Gotta say my brain is 'melted' down right now, so I can't really figure simple stuff out...

I have declared:
 
points = 2000


How do I remove fx. 100 from it?
So if I fx. loose a round of my poker game, I will loose 100 and that would mean points would automatically go 100 down.
so
cout << points;
will give
1900

Hope you guys can undestand. Please ask if I'm too confusing
Hi.

There is a set of operators that allows you to change value of the variable on the left hand side in some way.

To show what I mean, var + 2; won't change var at all (assuming var is an int). However, if you use var += 2; (+= is one of those operators), then var will be increased by 2.

In your case, the operator you're probably interested in is -=, which when used like var -= 2; will reduce var by 2.

Good luck. :)

-Albatross
Last edited on
closed account (4z0M4iN6)
Maybe I don't understand the problem. Normally I would use "-".

For substract I always used "-" and for addition always "+"
Last edited on
Yea thanks for the responses guys!
Exactly what I needed.
Topic archived. No new replies allowed.