#include #include //for the "i/o manipulators" setw and setprecision #include using namespace std; //Interest is 6% annually. int main() { double rate {0.0}; //start with this many dollars cout << "what is the interst rate?\n" //column headings cin >> rate ; if (!cin) { std::cerr << "sorry, that wasn't an acceptable number.\n"; return EXIT_FAILURE; } //Also make sure the rate is a reasonable (e.g.,positive) number. //Each year, multiply the principal by the following factor. //for example, if rate is 6, then factor will be 1.06 double factor {1.00 +.01 * rate}; for (int year {1}; year <= 10; ++year) { principal *= factor; //means principal = principal * factor cout << setw(4) << year << " $" << fixed << setprecision(2) << principal << "\n"; } return EXIT_SUCCESS; }