中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-07-31 22:59
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » 全屏幕模拟时钟的C源程序[转帖] 查看 840 回复 1
楼 主 全屏幕模拟时钟的C源程序[转帖] 发表于 2003-06-22 00:00 ·  中国 江西 吉安 电信
版主
★★★★
积分 7,296
发帖 1,628
注册 2002-10-16 12:00
23年会员
UID 10
性别 男
状态 离线
全屏幕模拟时钟的C源程序全屏幕模拟时钟的C源程序
#include
#include
#include
#define pi 3.1415926
#define X(a,b,c) x=a*cos(b*c*pi/180-pi/2)+300;
#define Y(a,b,c) y=a*sin(b*c*pi/180-pi/2)+240;
#define d(a,b,c) X(a,b,c);Y(a,b,c);line(300,240,x,y)
void init()
{int i,l,x1,x2,y1,y2;
setbkcolor(1);
circle(300,240,200);
circle(300,240,205);
circle(300,240,5);
for(i=0;i<60;i++)
{if(i%5==0) l=15;
else l=5;
x1=200*cos(i*6*pi/180)+300;
y1=200*sin(i*6*pi/180)+240;
x2=(200-l)*cos(i*6*pi/180)+300;
y2=(200-l)*sin(i*6*pi/180)+240;
line(x1,y1,x2,y2);
}
}
main()
{
int x,y;
int gd=VGA,gm=2;
unsigned char h,m,s;
struct time t;
initgraph(&gd,&gm,"d:\\tc";
init();
setwritemode(1);
gettime(t);
h=t.ti_hour;
m=t.ti_min;
s=t.ti_sec;
setcolor(7);
d(150,h,30);
setcolor(14);
d(170,m,6);
setcolor(4);
d(190,s,6);
while(!kbhit())
{while(t.ti_sec==s)
gettime(t);
sound(400);
delay(70);
sound(200);
delay(30);
nosound();
setcolor(4);
d(190,s,6);
s=t.ti_sec;
d(190,s,6);
if (t.ti_min!=m)
{
setcolor(14);
d(170,m,6);
m=t.ti_min;
d(170,m,6);
}
if (t.ti_hour!=h)
{ setcolor(7);
d(150,h,30);
h=t.ti_hour;
d(150,h,30);
sound(1000);
delay(240);
nosound();
delay(140);
sound(2000);
delay(240);
nosound();
}
}
getch();
closegraph();
}

辽宁省铁岭师范高等专科学校微机室版权所有&copy;2002
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
2 发表于 2003-07-24 00:00 ·  中国 广东 汕尾 电信
中级用户
★★
积分 417
发帖 137
注册 2003-05-30 00:00
23年会员
UID 2638
性别 男
状态 离线
3Q!
论坛跳转: