#include #include #include #include #include void main() { int gdriver=VGA,gmode=VGAHI; // registerbgidriver(EGAVGA_driver); initgraph(&gdriver,&gmode,""); time tim; const char a[12][3] = {"12","1","2","3","4","5","6","7","8","9","10","11"}; cleardevice(); float th[3]; int x =getmaxx()/2,y =getmaxy()/2,sec,min,hour; gettime(&tim); sec=(tim.ti_sec); min=(tim.ti_min); hour=(tim.ti_hour); setlinestyle(SOLID_LINE,0,3); setcolor(8); circle(x,y,235); setlinestyle(SOLID_LINE,0,1); circle(x,y,175); setfillstyle(1,7); floodfill(x+176,y,8); setcolor(RED); // settextstyle(SCRIPT_FONT,0,3); for(int i=0;i<12;i++) { int p = (i==0||i==11||i==10)*5; int q = (i==10)*4; outtextxy(x+210*sin(i*M_PI/6)-p,y-210*cos(i*M_PI/6)+q,a[i]); } setcolor(0); for(i=0;i<60;i++) { if(i%5==0) continue; outtextxy(x+210*sin(i*M_PI/30),y-210*cos(i*M_PI/30),"."); } setfillstyle(1,8); floodfill(x+143,y,7); setwritemode(1); // while (_bios_keybrd(_KEYBRD_READY) == 0) while(!kbhit()) { if(sec>=60) { sec%=60; min++; } if(min>=60) { min%=60; hour++; } if(min==0) { sound(500); delay(5); nosound(); } setcolor(BROWN); th[0] = sec*M_PI/30; line(x,y,x+170*sin(th[0]),y-170*cos(th[0])); line(x,y,x-20*sin(th[0]),y+20*cos(th[0])); setlinestyle(SOLID_LINE,0,3); setcolor(MAGENTA); th[1]=min*M_PI/30; line(x,y,x+150*sin(th[1]),y-150*cos(th[1])); line(x,y,x-8*sin(th[1]),y+8*cos(th[1])); setcolor(GREEN); th[2]=hour*M_PI/6+(min*M_PI/360); line(x,y,x+105*sin(th[2]),y-105*cos(th[2])); line(x,y,x-8*sin(th[2]),y+8*cos(th[2])); sound(300); delay(5); nosound(); delay(995); line(x,y,x+105*sin(th[2]),y-105*cos(th[2])); line(x,y,x-8*sin(th[2]),y+8*cos(th[2])); setcolor(MAGENTA); line(x,y,x+150*sin(th[1]),y-150*cos(th[1])); line(x,y,x-8*sin(th[1]),y+8*cos(th[1])); setlinestyle(SOLID_LINE,0,1); setcolor(BROWN); line(x,y,x+170*sin(th[0]),y-170*cos(th[0])); line(x,y,x-20*sin(th[0]),y+20*cos(th[0])); sec++; } getch(); closegraph(); }