Ok, trying to make a compound interest calculator that reads the input from a file then computes the total at the end. I'm having problems with my forumla as it is not displaying the right amount of compound interest.
My question is how can I keep track of the input and adding it into the total to compute interest. I thought I was doing it with the year++, but I guess not.
Thanks for taking a look at it. I'm new to programming and hate to be the newbie begging for help.
So each year, you're reading in a new value into invest, and assigning a new value to amount. Can you be more specific as to what you want your program to accomplish, or explain some of the reasoning behind your code?
If you want to calculate interest it should probably look something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13
...
double interest = 100.00;
double rate = 1.12; // 12% interest rate
int years;
cout << "Enter the amount of years that " << interest << " has been in your savings account, at an annual interest rate of 12%: ";
getline (cin, years, '\n');
for (int i = 0; i < years; i++)
interest *= rate;
cout << years << " years later, you now have: $" << interest << endl;
...