fork download
  1. #include <iostream>
  2. #include <ctime>
  3. using namespace std;
  4.  
  5. int main() {
  6. time_t now = time(0);
  7. tm *ltm = localtime(&now);
  8.  
  9. int hour = ltm->tm_hour;
  10.  
  11. if (hour < 12)
  12. cout << "Good Morning";
  13. else if (hour < 16)
  14. cout << "Good Afternoon";
  15. else
  16. cout << "Good Evening";
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Good Morning