Working on an assignment due tonight.I just had an issue like that!
I have a variable that is being changed between print statements, despite the fact the only time that variable gets changed is when it gets set originally.
In c# I replaced the variable with a function that acted like a variable. Then it could print a message everytime it was changed and tell me who changed it. Does c++ have similar?