本文共 742 字,大约阅读时间需要 2 分钟。
C语言显示系统时间的几个办法#include#include #include int main(){ time_t t = time(0); char tmp[64]; strftime( tmp, sizeof(tmp), "%Y/%m/%d %X %A 本月第%j天 %z",localtime(&t) ); puts( tmp ); return 0; }#include #include int main () { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); printf ( "The current date/time is: %s", asctime (timeinfo) ); } #include #include #include using namespace std;int main(){ time_t t; while(1) { time(&t); cout << ctime(&t) << endl; cout << asctime(localtime(&t)) << endl; Sleep(900); system("cls");//借助CLS实现动态更新时间 }}
DWORD end_time = GetTickCount();
DWORD start_time = GetTickCount();
转载地址:http://zoyhj.baihongyu.com/