Loading
新闻中心库存中心价格中心PDF中心图片中心
ICGLE 电子技术支持中心,为电气人员和相关企业提供全面的信息(IC技术\IC库存\IC图片\PDF资料等)服务
总线设计PCB设计单片机DSPARM
JAVA驱动设计C/C++汇编J2EE网络协议中间件技术嵌入式系统无线通信通信网络模拟技术接口电路显示光电传感与控制EDA/PLD
气流体控制电子产品电机及工具通信设备仪器仪表电线电缆建筑电气低压电器高压电器电源工控自动化广电设备医疗器械More..
电源设计仪器仪表技术专递电路图片电子专栏储存技术汽车电子测量测试音响技术家用电器
成功方案市场分析行业标准应用前沿芯片应用综合专区
全屏幕模拟时钟的C源程序
来源:普博C/C++语言世界   作者:佚名
字体大小:[大][中][小]


#include<graphics.h>
#include<math.h>
#include<dos.h>
#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[1];
initgraph(&gd,&gm,"d:\\tc");
init();
setwritemode(1);
gettime(t);
h=t[0].ti_hour;
m=t[0].ti_min;
s=t[0].ti_sec;
setcolor(7);
d(150,h,30);
setcolor(14);
d(170,m,6);
setcolor(4);
d(190,s,6);
while(!kbhit())
{while(t[0].ti_sec==s)
gettime(t);
sound(400);
delay(70);
sound(200);
delay(30);
nosound();
setcolor(4);
d(190,s,6);
s=t[0].ti_sec;
d(190,s,6);
if (t[0].ti_min!=m)
{
setcolor(14);
d(170,m,6);
m=t[0].ti_min;
d(170,m,6);
}
if (t[0].ti_hour!=h)
{ setcolor(7);
d(150,h,30);
h=t[0].ti_hour;
d(150,h,30);
sound(1000);
delay(240);
nosound();
delay(140);
sound(2000);
delay(240);
nosound();
}
}
getch();
closegraph();
}

Upload by 小刘(2007-5-31)
IC
IC
推荐技术文章:
IC
IC

©2007 版权归ICGLE所有   页面执行时间:62.500毫秒