#include <stdio.h>
#include <windows.h>
int main()
{
SYSTEMTIME st;
GetLocalTime(&st);
printf("%d-%02d-%02d %02d:%02d:%02d",st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
printf("\nAnd it's the %d day of a week.", st.wDayOfWeek);
system("pause");
return 0;
}
本文介绍了一个使用C语言和Windows API的简单程序,该程序能够获取并打印计算机的当前时间、日期以及星期几。通过调用GetLocalTime函数,程序可以准确地显示系统本地时间。
1万+

被折叠的 条评论
为什么被折叠?



