//object: creat a clock //writer: mike //time: 2020.09.10 #include<stdio.h> #include<Windows.h> #include<stdlib.h> int main(void) { int h = 0, m = 0, s = 0; printf("please inpyt the time such as hour:minute:second"); scanf("%d%d%d",&h, &m, &s); system("cls"); for(h; h <24; h++) { for(m; m<60; m++) { for(s; s<60; s++) { system("cls"); printf(" %d:%d:%d", h, m, s); if(h<12) { printf("AM"); } else { printf("PM"); } printf(" Friday september 10th 2020"); Sleep(1000); } s = 0; } m = 0; } h = 0; getchar(); getchar(); return 0; } //总体感觉表走的不准,很慢,可能和清屏函数有关。
不过我能查到的清屏函数也就是 cls了。