#include #include #include using namespace std; int main(){; cout<< "What is the deposit?"; double principal {0.0}; cin >> principal; if (!cin) { return EXIT_FAILURE; } if (principal <= 0) { cerr << "Please input positive number\n"; return EXIT_FAILURE; } cout << "What is the interest rate?\n"; double rate {0.0}; cin >> rate; if (!cin) { return EXIT_SUCCESS; } if (rate <= 0) { cerr << "Please input a positive number\n"; return EXIT_FAILURE; } cout << "How many years will the money be invested?\n"; int years {0}; cin >> years; if (!cin) { return EXIT_SUCCESS; } if (years <= 0) { cerr << "Please input a positive number\n"; return EXIT_FAILURE; } double factor {1.00 +.01 * rate}; cout << "year principal\n"; cout << "---- ---------\n"; for (int year {1}; year <= years; ++ year) { principal *= factor; cout << setw(4) << year << " $" << fixed << setprecision(2) << principal << "\n"; } return 0; }