0

How can a program overwrite a value by itself?

Hi I want to make a program which counts how much money will you have if you would despose a certain ammount od them to a bank. The code is something like this so far for (int=0;a<3;a++) { cout << n * 1.12 + n << endl; This code is supposed to take your constant monthly deposit multiply it by the bank interest and then add the constant once again. I end up with 3 same numbers because the code cannot overwrite the ammount of money for the end od each month. in short i don't know how to do the title thi

11th Apr 2017, 9:11 PM
Bartosz Pikutin
Bartosz Pikutin - avatar
1 Respuesta
0
If you want n to increase with each loop, you need to save the changes you made to n each time. Loopbody { n = n * 1.13f +n; Cout<<n<<endl; }
11th Apr 2017, 10:05 PM
pascaldos