# include & ltdos.h & gt
# include & ltconio.h & gt
# include & ltmath.h & gt
# include & ltgraphics.h & gt
#定義PI 3.1415926
int main()
{
int X=300,Y=250,R=100,RR = 130;
int X_HOUR,X_MINUTE,X _ SECOND
int Y_HOUR,Y_MINUTE,Y _ SECOND
int X_DRAW=0,Y_DRAW=0,R _ DRAW = 120;
int NUM = 0;
結構時間T;
int gdriver=DETECT,gmode
init graph(& amp;g driver & amp;gmode," C:\ Program Files \ WINYES \ TC 201E \ BGI ");
setlinestyle(0,1,3);
setcolor(淺灰色);
circle(X,Y,RR);
setlinestyle(0,1,1);
for(NUM = 0;NUM & lt12;NUM++)
{
set color(11);
X _ DRAW = X+R _ DRAW * cos(NUM * 2 * PI/12);
Y _ DRAW = Y+R _ DRAW * sin(NUM * 2 * PI/12);
circle(X_DRAW,Y_DRAW,5);
setfillstyle(1,11);
if((NUM%3)==0)floodfill(X_DRAW,Y_DRAW,11);
}
而(!kbhit())
{
gettime(& amp;t);
X _ HOUR = X+(R/2)* cos(t . ti _ HOUR * 2 * PI/12+t . ti _ min * 2 * PI/(60 * 12)-PI/2);
X _ MINUTE = X+R * cos(t . ti _ min * 2 * PI/60-PI/2)* 3/4;
X _ SECOND = X+R * cos(t . ti _ sec * 2 * PI/60-PI/2);
y _ HOUR = X+(R/2)* sin(t . ti _ HOUR * 2 * PI/12+t . ti _ min * 2 * PI/(60 * 12)-PI/2);
Y _ MINUTE = Y+R * sin(t . ti _ min * 2 * PI/60-PI/2)* 3/4;
Y _ SECOND = Y+R * sin(t . ti _ sec * 2 * PI/60-PI/2);
setcolor(黃色);
line(X,Y,X_HOUR,Y _ HOUR);
setcolor(紅色);
line(X,Y,X_MINUTE,Y _ MINUTE);
setcolor(藍色);
line(X,Y,X _秒,Y _秒);
延時(10000);
setcolor(黑色);
line(X,Y,X_HOUR,Y _ HOUR);
line(X,Y,X_MINUTE,Y _ MINUTE);
line(X,Y,X _秒,Y _秒);
}
getch();
closegraph();
返回0;
}