#include #include #include int main() // a compound interest program/ { float capital, amount, rate, nyrs; cout << "This program calculates the amount of money\n"; cout << "in a bank account for an initial deposit\n"; cout << "invested for n years at an interest rate r.\n\n"; cout << "Enter the initial amount in the account: "; cin >> amount; cout << "Enter the number of years: "; cin >> nyrs; capital = amount * pow((1 + rate/100.0), nyrs); // set output formats cout << setiosflags(ios::fixed) << setiosflags(ios::showpoint) << setprecision(2); cout << "\nThe final amount of money is " << setw(8) << '$' << capital << endl; return 0; }