Your problems are caused by your lack of understanding of C++ or even programming in general. The fact that you have a variable "x" in some place doesn't mean that another variable called "x" in a different scope will have the same value as the other one.
Bookmarks