#include #include using namespace std; /* Introducing cin and cerr, two more members of namespace std. And another possible exit status number, EXIT_FAILURE. The if (!cin) means "if cin is in an unhealthy state as a result of the failure of the previous attempt at input". */ int main() { cout << "Please type the price and press RETURN.\n"; //or press ENTER int price {0}; //This variable will die whenever we return from main. cin >> price; if (!cin) { cerr << "Sorry, that wasn't an acceptable number.\n"; return EXIT_FAILURE; } cout << "Thank you, the variable contains " << price << ".\n"; return EXIT_SUCCESS; }