fork download
  1. #include <string>
  2. #include <iostream>
  3. #include <chrono>
  4. #include <ctime>
  5.  
  6. std::string daysInMonth(int month, std::string months[12])
  7. {
  8. return months[month - 1];
  9. }
  10.  
  11. int main()
  12. {
  13. time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
  14. struct tm * ptm = localtime(&tt);
  15. std::string months[12] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
  16. int month = ptm->tm_mon + 1;
  17.  
  18. std::cout << daysInMonth(month, months);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
May