#include #include //for the "i/o manipulators" setw and setprecision #include using namespace std; //Interest is 6% annually. int main() { double rate {0.0}; double principal {1000.00}; //start with this many dollars cout << "What is the interest rate?\n"; cin >> rate; if (!std::cin) { std::cerr << "Sorry, that wasn't an acceptable number.\n"; return EXIT_FAILURE; //Ouput an error message to cerr and return EXIT_FAILURE } for (int year {1}; year <= 10; ++year) { principal *= 1.06; //means principal = principal * 1.06 cout << setw(4) << year << " $" << fixed << setprecision(2) << principal << "\n"; } return EXIT_SUCCESS; }