VC++语言如何输出当前日期,如何获取当前日期
//writeby: lhsbqb //date:2012-10-17 //title:VC++语言如何输出当前日期,如何获取当前日期 #include "time.h" #include "iostream.h" #include "windows.h" int main(int argc, char* argv[]) { time_t nowTime; while(true) { time(&nowTime); struct tm *sysTime = localtime(&nowTime); system("title 蟒蛇软件站 http://www.pythonschool.com"); system("mode con cols=55 lines=2"); system("cls"); cout << "系统日期:" << 1900 + sysTime->tm_year << "年" << sysTime->tm_mon+1 << "月" << sysTime->tm_mday << "日" <<sysTime->tm_hour << "时" << sysTime->tm_min << "分" << sysTime->tm_sec << "秒" << endl; Sleep(1000); } //time_t timer = time(NULL); //cout << ctime(&timer) << endl; return 0; }
学习笔记转摘于:
丝酷网 http://www.pythonschool.com/