essentially I have to use this formula (supposedly)
Accumulative Value = investmentAmount * (1 + MonthlyInterestRate) NumberofYears*12 I think that is supposed to be a power--
to yield a table that looks like this
Years Future value
1 1093.8
2 1196.41
3 ..
30 14730.57
The issue I am having is with the formula. I do not think it is right.
I can get the right values for year 1 but thats it.
any suggestions?
# include <iostream>
# include <cmath>
# include <string>
# include <iomanip>
using namespace std;
int main ()
{
//declaring the variables
double initial = 0;
int years;
double annualinterest = 0;
double monthlyinterest = 0;
double future = 0;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision (2);
// executable section
cout << "Please enter an investment principal " << endl;
cin >> initial;
cout << "Please enter the interest rate " << endl;
cin >> annualinterest;
cout << "Year" << setw (27) << "Future Value" <<endl;
for (years = 1; years <=30; years++)
{
monthlyinterest = (annualinterest /100) / 12;
future = pow((monthlyinterest + 1),12) * (years) * (initial);
cout << years << setw (27) << future << endl;
}
return 0;
}

New Topic/Question
Reply




MultiQuote





|