program clock; uses crt,graph,dos; var gb, gm, R: integer; x,y,x1,y1,u1,u,x2,y2,u2: real; i: integer; s: string[2]; h,m,c,d,c1: word; changed: boolean; const delta_hr: integer = 0; delta_min: integer = 0; delta_sec: integer = 0; delta = 60; { sec } to_exit: boolean = false; begin gb:=detect; initgraph(gb,gm,''); R:=80;x:=320;y:=240; x1:=320;y1:=240;u:=-pi/2; x2:=320;y2:=240; setfillstyle(1,6); bar(0,300,640,480); setfillstyle(10,2); bar(0,0,640,300); setfillstyle(1,7); setcolor(7); sector(250,150,35,215,30,30); sector(390,150,325,360,30,30); sector(390,150,0,143,30,30); setlinestyle(0,0,3); line(250,150,270,170); line(390,150,370,170); bar(305,120,335,125); line(320,125,320,170); setlinestyle(0,0,1); sector(320,360,0,180,60,40); setfillstyle(1,6);setcolor(6); fillellipse(320,370,40,25); setfillstyle(1,7); fillellipse(320,240,R+20,R+20); setbkcolor(0); for i:=1 to 12 do begin u:=u+pi/6; x:=(R+10)*cos(u)+317;y:=(R+10)*sin(u)+237; str(i,s); outtextxy(round(x),round(y),s); end; for i:=1 to 60 do begin u:=u+pi/30; x:=(R+17)*cos(u)+320;y:=(R+17)*sin(u)+240; putpixel(round(x),round(y),1); end; for i:=1 to 12 do begin u:=u+pi/6; x:=(R+17)*cos(u)+320;y:=(R+17)*sin(u)+240; setcolor(1); setfillstyle(1,7); fillellipse(round(x),round(y),2,2); circle(round(x),round(y),2); end; changed := false; repeat gettime(h,m,c,d); if keypressed then begin case readkey of #0: case readkey of #75: { lt } begin changed := true; dec(delta_sec, delta); while delta_sec < 0 do begin inc(delta_sec, 60); dec(delta_min); if delta_min < 0 then begin inc(delta_min, 60); dec(delta_hr); end end; end; #77: { rg } begin changed := true; inc(delta_sec, delta); while delta_sec >= 60 do begin dec(delta_sec, 60); inc(delta_min); if delta_min >= 60 then begin dec(delta_min, 60); inc(delta_hr); end end; end; end; #27: to_exit := true; end; while keypressed do readkey; end; inc(h, delta_hr); inc(m, delta_min); inc(c, delta_sec); if (c1<>c) or changed then begin c1:=c; setcolor(7); line(320,240,round(x),round(y)); line(320,240,round(x1),round(y1)); setlinestyle(0,0,3); line(320,240,round(x2),round(y2)); x2:=(R-23)*cos(u2)+320;y2:=(R-30)*sin(u2)+240; setcolor(9); line(320,240,round(x2),round(y2)); setlinestyle(0,0,1); x1:=(R-15)*cos(u1)+320;y1:=(R-15)*sin(u1)+240; setcolor(1); line(320,240,round(x1),round(y1)); x:=(R)*cos(u)+320;y:=(R)*sin(u)+240; setcolor(4); line(320,240,round(x),round(y)); setcolor(4); setfillstyle(1,4); fillellipse(320,240,3,3); u:=(c+45)*pi/30; u1:=(m+45)*60*pi/1800; u2:=(h*5+m/15+45)*3600*pi/108000; if changed then changed := false; end; until to_exit; closegraph; end.