计算机二级考试c语言过关经验(2)
计算机二级考试c语言过关经验
/* install the graphic device.the third parameter is the path of the driver*/
setbkcolor(0);
setcolor(WHITE);
while(1)
{
circle(x,y,r);/*paintthecircle*/
line(x,y+r-10,x,y+r-12);
line(x+r-4,y,x+r,y);
line(x-r,y,x-r+4,y);
line(x,y-r+10,x,y-r+10+2); /* draw the fout scales */
gettime(&t);
sprintf(s,"The current time is %2d:%02d:%02d\n",t.ti_hour,t.ti_min,t.ti_sec,t);
outtextxy(0,0,s); /* out put the current time */
outtextxy(0,10,"This clock is written by lijun"); /*?show the auther */
coss=(int)((r-10)*cos(t.ti_sec*3.14f/30-3.14f/2)+x);
sins=(int)((r-10)*sin(t.ti_sec*3.14f/30-3.14f/2)+y);
cosm=(int)((r-19)*cos(t.ti_min*3.14f/30-3.14f/2)+x);
sinm=(int)((r-19)*sin(t.ti_min*3.14f/30-3.14f/2)+y);
cosh=(int)((r-28)*cos((t.ti_hour+(float)(t.ti_min)/60)*3.14f/6-3.14f/2)+x);
sinh=(int)((r-28)*sin((t.ti_hour+(float)(t.ti_min)/60)*3.14f/6-3.14f/2)+y);
/* calculate the position of the three points */
setcolor(14);
line(x,y,coss,sins);
setcolor(13);
line(x,y,cosm,sinm);
setcolor(10);
line(x,y,cosh,sinh);
setcolor(15);
/* draw the points */
sleep(1);
clrscr();&nb
c语言暑期培训班sp;
keydown=kbhit();/* check whether key down */
if(keydown)
{
closegraph();/* close graphic device */
exit(0);
}
}
}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论