I'm a little new to c++ and I hate running across situations where I need to store a previous value in another variable. So my question is, can I make a variable in a sense store two values. I wish I could have the ability to recall previously stored values and use them in other functions.
ex) Current way
int x1 = 5;
int x2 = x1 + 5;
int diff = x2 - x1;
What I want to do
int x = 5;
x = x + 5;
int diff = x - old_x;