#include #include using namespace std; int main() { cout << "Please type the hour (0–23): "; int hour {0}; cin >> hour; if (!cin) { cerr << "Sorry, that wasn't a number.\n"; return EXIT_FAILURE; } if (hour < 12) { // before noon cout << "Good morning\n"; } else if (hour < 17) { // 12:00–16:59 cout << "Good afternoon\n"; } else if (hour < 21) { // 17:00–20:59 cout << "Good evening\n"; } else { // 21:00–23:59 cout << "Good night\n"; } return EXIT_SUCCESS; }