Subtract from Structure values.

I have a structure which is like:

1
2
3
4
struct character {
  int health, strengh, agility, xCoord, yCoord;
  string classes, name, mof, skill1, skill2, skill3;
} character;


I set: character.health = 100; which worked, however when i try subtracting 10 from my int main(), it stays the same.

I tried doing: character.health - 45; but it still stays at 100.
Um... did you maybe mean:
character.health -= 45;
...?

What you're doing now is subtracting 45 from 100 which results in 55 as it should, but character.health doesn't change as a result of the subtraction.

-=, however, will change the value on the left side.

-Albatross
Last edited on
Ive been puttin =- for a long time. THANK YOU!
Topic archived. No new replies allowed.