#include #include #include using namespace std; int main() { double principal; int years; double ratePercent; cout << "Enter principal amount: "; if (!(cin >> principal)) return EXIT_FAILURE; cout << "Enter number of years: "; if (!(cin >> years)) return EXIT_FAILURE; cout << "Enter annual interest rate (percent): "; if (!(cin >> ratePercent)) return EXIT_FAILURE; double amount = principal; for (int y = 1; y <= years; ++y) { amount *= (1.0 + ratePercent / 100.0); } cout << fixed << setprecision(2); cout << "Starting with $" << principal << ", after " << years << " years at " << ratePercent << "%, you will have $" << amount << "." << endl; return EXIT_SUCCESS; }