#include #include #include //for the functions time and localtime using namespace std; int main() { //Get the current month of the year (0 to 11 inclusive). time_t t {time(nullptr)}; tm *p = {localtime(&t)}; int month {p->tm_mon}; if (month == 0) { cout << "January"; } else if (month == 1) { cout << "February"; } else if (month == 2) { cout << "March"; } else if (month == 3) { cout << "April"; } else if (month == 4) { cout << "May"; } else if (month == 5) { cout << "June"; } else if (month == 6) { cout << "July"; } else if (month == 7) { cout << "August"; } else if (month == 8) { cout << "September"; } else if (month == 9) { cout << "October"; } else if (month == 10) { cout << "November"; } else if (month == 11) { cout << "December"; } else { //none of the above cerr << "Bad month " << month << " should have been in range 0 to 11 inclusive.\n"; return EXIT_FAILURE; } cout << "\n"; return EXIT_SUCCESS; }