Im trying to calculate the balance at the end of the year given an annual investment, and a percentage rate of return. to do this im just putting the equation into a new variable labelled endYearBalance. when i try to use endYearBalance in the cout it gives me the wrong answer but when i take just the equation and stick it in, it gives me the right answer.... any help? the reason im trying to create a new variable for the equation is because this program should calculate and display the amount of years it will take to reach your ending investment goal...any help is appreciated
You are calculating the endYearBalance on line 6 before you've even read the values the user input. So it's working with whatever data you pass, not what user inputs.