跳到正文

休闲·娱乐

时钟

seanli1008约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年5月18日
篇幅
约 1 分钟

版本

  1. v1当前
C++
#include <bits/stdc++.h>
#include <windows.h>
#include <time.h>
using namespace std;
string day[10]={"","一","二","三","四","五","六","日"};
int main(){
	while(true){
		system("cls");
		time_t timep;
    	struct tm *p;
    	time (&timep);
    	p=gmtime(&timep);
    	printf("%d",1900+p->tm_year);
    	printf("年");
    	printf("%d",1+p->tm_mon);
    	printf("月");
    	printf("%d",p->tm_mday);
    	printf("日    星期");
    	printf("%s",day[p->tm_wday].c_str());
    	printf("\n");
    	printf("%d:%d:%d\n",8+p->tm_hour,p->tm_min,p->tm_sec);
    	Sleep(15);
	}
    return 0;
}
原文