#include #include #include //for class system_clock #include //for the function localtime using namespace std; int main() { const auto now {chrono::system_clock::now()}; const time_t t {chrono::system_clock::to_time_t(now)}; const tm *const p {localtime(&t)}; //Get the current hour of the day (0 to 23 inclusive). const int hour {p->tm_hour}; if (hour < 12) { cout << "Good morning"; } else if (hour < 12 + 5) { cout << "Good afternoon."; } else if (hour < 12 + 9) { cout << "Good evening."; } else { cout << "Good night."; } cout << "\n"; return EXIT_SUCCESS; }