【文件属性】:
文件名称:时钟模拟程序
文件大小:32KB
文件格式:DOC
更新时间:2015-08-21 11:52:47
时钟模拟程序
实用 通过
部分:
void main()
{
initgraph(640, 480); // 初始化 640 x 480 的绘图窗口
DrawDial(); // 绘制表盘
setwritemode(R2_XORPEN); // 设置 XOR 绘图模式
// 绘制表针
SYSTEMTIME ti; // 定义变量保存当前时间
while(!kbhit()) // 按任意键退出钟表程序
{
GetLocalTime(&ti;); // 获取当前时间
DrawHand(ti.wHour, ti.wMinute, ti.wSecond); // 画表针
Sleep(1000); // 延时 1 秒
DrawHand(ti.wHour, ti.wMinute, ti.wSecond); // 擦表针(擦表针和画表针的过程是一样的)
}
closegraph(); // 关闭绘图窗口
}