Hi I am very new to C++ and I was told to make a program that start with the ammount you choose but it has compound interest of 6% a year (0.5% a month) and you take out 500 dollars a month, at what months and years would the account be depleted...

I started by

#include <iostream>

using namespace std;   //introduces namespace std
int main()
{
        float ibalance;
        int month, year, interest, withdrawn;

//inputting balance
        cout << "Enter Balance: ";
        cin >> ibalance;

//starting of loop for month
    for (month= 0; month < 12; month++);

    cout << month << endl;

return 0       
}

I am very lost on how to put interest and withdrawn and with with the Year loop... any tips on how i can continue?

Try, instead of a for loop, using while (ibalance != 0) Also, just calculate the interest, subtract the 500 from ibalance, and increment the month during the while loop. Then when you want to find out how long it took change the number of months into months and years

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.