#include #include // for EXIT_FAILURE and EXIT_SUCCESS using namespace std; int main() { int teabags; cout << "Enter the number of teabags: "; cin >> teabags; if (!cin) { cerr << "Sorry, that wasn't a valid whole number.\n"; return EXIT_FAILURE; // teabags die here; brewing time not born yet. } if (teabags < 1) { cerr << "Sorry, you must use at least 1 teabag.\n"; return EXIT_FAILURE; // teabags die here; brewing time not born yet. } // Brewing time formula based on number of teabags. int minutes {5 + 2 * (teabags - 1)}; // Simpler expression with the same value: // int minutes {3 + 2 * teabags}; cout << "Brew the tea for " << minutes << " minutes.\n"; return EXIT_SUCCESS; // teabags and minutes die here. }