#include #include #include using namespace std; const int BUF_MAX = 100; int main() { time_t now; tm * bdTime; char timeString[BUF_MAX]; time(&now); now += 60*60*4; bdTime = localtime(&now); cout << "The day is " << bdTime->tm_wday << endl; cout << "The year is " << bdTime->tm_year+1900 << endl; cout << "And the date is " << asctime(bdTime) << endl; strftime(timeString, BUF_MAX,"Year: %Y, Month: %B Day: %A Hour: %I %p", bdTime); cout << "But that is also " << timeString << endl; return 0; }