#include #include #include //for the functions time and localtime using namespace std; //Output the current local date and time. int main() { const time_t t {time(nullptr)}; const tm *const p {localtime(&t)}; //Output the fields of the structure that p points to. cout << "The current year is " << p->tm_year + 1900 << ".\n"; cout << "The current month (1 to 12) is " << p->tm_mon + 1 << ".\n"; cout << "The current day (1 to 31) is " << p->tm_mday << ".\n\n"; cout << "The current hour (0 to 23) is " << p->tm_hour << ".\n"; cout << "The current minute (0 to 59) is " << p->tm_min << ".\n"; cout << "The current second (0 to 61) is " << p->tm_sec << ".\n\n"; cout << "Daylight Savings Time is "; if (p->tm_isdst == 0) { cout << "not "; } cout << "in effect.\n"; return EXIT_SUCCESS; }