You are using a version without Ads of this website. Please, consider donating:

### trouble with cpp problem, for loop, need Help!

I am starting out with cpp and having trouble to solve this problem I know that it needs a loop but I cannot seem to understand the structure.

If interest is compounded annually, it grows as follows. Suppose P0 is the initial amount and INT is the interest rate per year. If P1 and P2, and P3 is the balance at the end of the first, second , and third year respectively, then:

P1 = P0 + P0 * INT = P0 * (1 + INT)
P2 = P1 + P1 * INT = P1 * (1 + INT) = P0 * (1 + INT) * (1 + INT) = P0 * (1 + INT)2
P3 = P2 + P2* INT = P2 * (1 + INT) = P0 * (1 + INT) * (1 + INT) * (1 + INT)
= P0 * ( 1 + INT)3
and so on.

When money is deposited in an IRA account, it is usually sheltered from taxes. until the money is withdrawn after the age of 59. If someone opened account on their sixteenth birthday at 10% interest, On their sixtieth birthday they look at the account, The money has compounded annually at the 10% rate. program should read in an initial amount and compute the total amount in the account on their sixtieth birthday.

If they decide to leave the money in for another year. Starting from their sixty-first birthday, they decide to withdraw each yearâ€™s interest income. In other words, you withdraw the interest and leave the rest of the money untouched. How much income for the rest of your life would you have?

The output could be

initial investment amount
number of years invested up through your sixtieth birthday
interest accumulated as of their sixtieth birthday
total value of the investment on their sixty-first birthday
and amount of income per year after their sixty-first birthday

Thank you so much for your help!

Just create a loop that outputs each of those values to a global variable before the next calculation.
Topic archived. No new replies allowed.