Looping Help!
return 0;
}
Last edited on
Can anybody help?
Please use code tags when posting.
http://www.cplusplus.com/articles/z13hAqkS/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const double ONE_HUNDRED = 100.00;
double money = 0, moneytotal = 0;
cout << "Enter the amount of money being invested in a bank account: $";
cin >> money;
cin.ignore();
for(int intrest = 6; intrest <= 12; intrest++)
{
moneytotal = money;
for(int i = 0; i < 10; i++)
{
moneytotal +=(intrest / ONE_HUNDRED * moneytotal);
}
cout << "Amount from " << intrest/ONE_HUNDRED << "% after the first 10 years: $" << fixed << setprecision(2) << moneytotal << endl;
}
cin.ignore();
return 0;
}
|
Last edited on
Topic archived. No new replies allowed.