| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- uses graph,crt,vga,DOS;
- var
- i,j,x,y,x1,y1,x02,y02,x12,y12 : integer;
- SecX,SecY,SecXL,SecYL,HourX,HourY,HourXL,HourYL,MinX,MinY,MinXL,MinYL
- : real;
- Hour : string;
- TH,TM,TS,TMS,THL,TML,TSL : word;
- const
- Rad1=200;
- Rad2=180;
- CenX=320;
- CenY=240;
- begin
- InitVGA;
- Circle(CenX,CenY,Rad1);
- x:=rad2;
- y:=0;
- x1:=rad1;
- y1:=0;
- SetTextJustify(CenterText,CenterText);
- for i:= 1 to 60 do
- begin
- Line(cenx+X1,ceny+Y1,cenX+X,CenY+Y);
- if (I) mod 5 = 0 then begin
- x1:=round(rad1*cos(6*i*pi/180));
- y1:=round(rad1*sin(6*i*pi/180));
- x:=round(rad2*cos(6*i*pi/180));
- y:=round(rad2*sin(6*i*pi/180));
- end
- else begin
- x1:=round(rad1*cos(6*i*pi/180));
- y1:=round(rad1*sin(6*i*pi/180));
- x:=round((rad1-5)*cos(6*i*pi/180));
- y:=round((rad1-5)*sin(6*i*pi/180));
- end;
- if (I) mod 5 = 0 then begin
- str(((I-1) div 5+3) mod 12+1,hour);
- OutTextXY(cenx+round((rad2-10)*cos(6*i*pi/180)),
- ceny+round((rad2-10)*sin(6*i*pi/180)),hour);
- end;
- end;
- GetTime(TH,TM,TS,TMS);
- TH:=TH mod 12;
- SecXL:=round((rad1-10)*cos((6*TS-90)*pi/180));
- SecYL:=round((rad1-10)*sin((6*TS-90)*pi/180));
- MinXL:=round((rad2-10)*cos((6*TM+6/60*TS-90)*pi/180));
- MinYL:=round((rad2-10)*sin((6*TM+6/60*TS-90)*pi/180));
- HourXL:=round((rad2-70)*cos((30*TH+0.5*TM+30/60/60*TS-90)*pi/180));
- HourYL:=round((rad2-70)*sin((30*TH+0.5*TM+30/60/60*TS-90)*pi/180));
- SetWriteMode(XORPut);
- Line(CenX,CenY,round(CenX+HourXL),round(ceny+HourYL));
- Line(CenX,CenY,round(CenX+MinXL),round(ceny+MinYL));
- Line(CenX,CenY,round(CenX+SecXL),round(ceny+SEcYL));
- repeat
- GetTime(THL,TML,TSL,TMS);
- if (TH<>THL) or (TM<>TML) or (TS<>TSL) then begin
- Line(CenX,CenY,round(CenX+HourXL),round(ceny+HourYL));
- Line(CenX,CenY,round(CenX+MinXL),round(ceny+MinYL));
- Line(CenX,CenY,round(CenX+SecXL),round(ceny+SEcYL));
- SecX := SecXL*cos(6*pi/180) - SecYL*sin(6*pi/180);
- SecY := SecXL*sin(6*pi/180) + SecYL*Cos(6*pi/180);
- MinX := MinXL*cos(6/60*pi/180) - MinYL*sin(6/60*pi/180);
- MinY := MinXL*sin(6/60*pi/180) + MinYL*Cos(6/60*pi/180);
- HourX := HourXL*cos(6/60/12*pi/180) - HourYL*sin(6/60/12*pi/180);
- HourY := HourXL*sin(6/60/12*pi/180) + HourYL*Cos(6/60/12*pi/180);
- Line(CenX,CenY,round(CenX+HourX),round(ceny+HourY));
- Line(CenX,CenY,round(CenX+MinX),round(ceny+MinY));
- Line(CenX,CenY,round(CenX+SecX),round(ceny+SEcY));
- SecXL:=SecX;
- SecYL:=SecY;
- minXL:=MinX;
- MinYL:=MinY;
- HourXL:=HourX;
- HourYL:=HourY;
- end;
- TH:=THL;
- TM:=TML;
- TS:=TSL;
- until keypressed;
- Closegraph;
- end.
|