I have to write a program for my computer science class to determine the future value of a given amount of money. I'm close I know it, but I'm currently stuck. My teacher also provided sample input and sample output that i should have, along with the formula that should be used. I also have to use the libraries provided (they're in the code already) Can you guys help? My current issues are getting the output in the right format and the program closes immediately after getting the result.
Sample input 1000 2 5 (1000 deposited for 2 years at an interest of 5%)
Sample output $1000 deposited for 2 years at 5.00% interest = 1102.50
My code so far:
using namespace std;
cout <<"Enter initial deposit:";
cout<<"Enter number of years:";
cout<<"Enter an interest rate:";
The first thing I notice is that the interest formula you have is not right. It looks like you have a mixture of both compound and continuous interest going on which would produce an incorrect amount for either.
is the formula for continuously compounding interest, which is what it would take to get your desired amount. P= principal i=interest rate and n = number of years.
Would be enough to keep the window open for now, but there are tons of solutions stickied at the top of this forum. Hope this helps