Im working on an assignment and having trouble with it. The code I have so far is written below. Im confused about how to have a user cin an initial amount, cin an interest amount, and update each year (1-10) a total earned off of that interest. I have been trying at this for some time now and would like any hints or suggestions so I can finish this. I was thinking I needed a nested loop but that wasnt working.
1 2 3 4 5 6 7 8 9 10 11
// For example, if the initial amount is $1000 with an interest rate of 6.5%,
// the output should be the following.
//
//
// Year Balance
// ______ _______
// 1 1065.00
// 2 1134.22
// 3 1207.94
// . .
// . .
I do not know the formula equivalent. Even if I use it, im not sure exactly how to implement it to complete the "Balance" column shown above in the example.
I knew the formula... I guess to be honest with you I just didnt think about using it. I know there is no "^" and that the #include <cmath> needs to be used for pow. Im not sure what you meant in your hint though.
int main()
{
// int amount;
double interest;
double balance;
// double per;
cout << "What is the initial amount in the account? ";
cin >> balance;
cout << "What is the interest rate? ";
cin >> interest;