1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <iostream>
#include <string>
#include <ctime>
using namespace std;
const string DAYS[]={"Sunday","Monday","Tuesday",
"Wednesday","Thursday","Friday","Saturday"};
const string MONTHS[]={"January","February","March","April","May","June",
"July","August","September","October","November","December"};
int main()
{
int wday, mday, month, year;
time_t rawtime;
tm * timeinfo;
time(&rawtime);
timeinfo=localtime(&rawtime);
wday=timeinfo->tm_wday;
mday=timeinfo->tm_mday;
month=timeinfo->tm_mon;
year=timeinfo->tm_year;
cout << DAYS[wday] << ", ";
cout << MONTHS[month] << " " << mday << ", ";
cout << 1900+year << endl;
cout << "\nhit enter to quit...";
cin.get();
return 0;
}
|