#include <graphics.h>#include <conio.h>#include <iostream.h>#include <math.h>#include <time.h>#include <Mmsystem.h>#include <stdio.h>#include <stdlib.h>#pragma comment ( lib, "Winmm.lib" )int main(){ time_t timep; struct tm *p; initgraph(600, 600); // 初始化一个宽600,高600的正方形画布。 while(!kbhit())// 如果没有键盘敲击,则一直循环,否则结束循环 { /* 当前系统时间获取 时 p->tm_hour 分 p->tm_min 秒 p->tm_sec */ time(&timep); p = gmtime(&timep); // 输出 时 分 秒 查看。时需要+8个时区才是北京时间。 // 如果需要当前小时的信息 使用 p->tm_hour+8,使用分 p->tm_min 使用秒 p->tm_sec printf("%d %d %d\n", p->tm_hour+8, p->tm_min, p->tm_sec); //开始画出当前时分秒时间的手表界面 cleardevice();// 首先清空之前画布上的所有内容 Sleep(1000); //睡眠1000毫秒,即暂停1秒时间 } printf("\n"); system("pause"); closegraph(); return 0;}
目前暂无任何回答
- 0 回答
- 0 关注
- 1232 浏览
添加回答
举报
0/150
提交
取消