What is the problem and how is resolvable?
It is further down, the issue is not in the input
You need to read a textbook and understand basics of the language. Statements executed from left to right, from top to bottom. So if you have user input further down you get user input after you used unitiliazed variables for calculation. Code that you write are not mathematical equations, but instructions to virtual C++ machine what to do in each step.