program Zad; Uses Graph, CRT; const pi=3.1415926535897932; label a1,a2; procedure InitGr; var gd,gm: integer; begin gd := Detect; InitGraph (gd, gm, '..\bgi'); if Graphresult <> 0 then Halt; end; var i,x,y,r,a,h,j,k: integer; v:real; s,l:string; begin randomize; write('Vvedite rost v metrah:'); read(h); write('Vvedite skorost mk/chas:'); read(v); v:=v*(random(20)/100)+v; InitGr; circle(30,350,10); line(26,360,26,370); line(34,360,34,370); line(16,370,26,370); line(34,370,44,370); line(16,370,16,410); line(44,370,44,410); line(16,410,44,410); line(20,410,20,450); line(22,410,22,450); line(40,410,40,450); line(42,410,42,450); line(15,370,6,400); line(45,370,55,400); a1: line(1,450,640,450); line(635,450,635,280); line(635,300,615,300); line(635,320,615,320); line(615,290,615,330); line(616,290,616,330); outtextxy(10,460,'Ugol broska:'); str(a,l); outtextxy(110,460,l); setcolor(green); outtextxy(140,460,'Brosit mach - "probel"'); setcolor(red); outtextxy(500,460,'Vuhod - "Esc"'); s:=readkey; while (ord(s[1]) <> 32) or (ord(s[1])=27) do begin s:=readkey; if (ord(s[1]) = 72) and (a<90)then begin setcolor(black); outtextxy(110,460,l); a:=a+10; str(a,l); setcolor(white); outtextxy(110,460,l); end; if (ord(s[1])= 80) and (a>0) then begin setcolor(black); outtextxy(110,460,l); a:=a-10; str(a,l); setcolor(white); outtextxy(110,460,l); end; if (ord(s[1]) =77) and (j<500) then begin setcolor(black); circle(30-j,350,10); line(26-j,360,26-j,370); line(34-j,360,34-j,370); line(16-j,370,26-j,370); line(34-j,370,44-j,370); line(16-j,370,16-j,410); line(44-j,370,44-j,410); line(16-j,410,44-j,410); line(20-j,410,20-j,450); line(22-j,410,22-j,450); line(40-j,410,40-j,450); line(42-j,410,42-j,450); line(15-j,370,6-j,400); line(45-j,370,55-j,400); j:=j+10; setcolor(white); circle(30+j,350,10); line(26+j,360,26+j,370); line(34+j,360,34+j,370); line(16+j,370,26+j,370); line(34+j,370,44+j,370); line(16+j,370,16+j,410); line(44+j,370,44+j,410); line(16+j,410,44+j,410); line(20+j,410,20+j,450); line(22+j,410,22+j,450); line(40+j,410,40+j,450); line(42+j,410,42+j,450); line(15+j,370,6+j,400); line(45+j,370,55+j,400); end; if (ord(s[1]) =75) and (j>0) then begin setcolor(black); circle(30+j,350,10); line(26+j,360,26+j,370); line(34+j,360,34+j,370); line(16+j,370,26+j,370); line(34+j,370,44+j,370); line(16+j,370,16+j,410); line(44+j,370,44+j,410); line(16+j,410,44+j,410); line(20+j,410,20+j,450); line(22+j,410,22+j,450); line(40+j,410,40+j,450); line(42+j,410,42+j,450); line(15+j,370,6+j,400); line(45+j,370,55+j,400); j:=j-10; setcolor(white); circle(30-j,350,10); line(26-j,360,26-j,370); line(34-j,360,34-j,370); line(16-j,370,26-j,370); line(34-j,370,44-j,370); line(16-j,370,16-j,410); line(44-j,370,44-j,410); line(16-j,410,44-j,410); line(20-j,410,20-j,450); line(22-j,410,22-j,450); line(40-j,410,40-j,450); line(42-j,410,42-j,450); line(15-j,370,6-j,400); line(45-j,370,55-j,400); end; end; if ord(s[1])=32 then begin for i:=1 to 320 do begin x:=i*round(v*cos(a*pi/180))+55+j; y:=400+round(-(i*sin(a*pi/180))-h*25+0.005*i*i); if (x>616) and (y<340) and (y>280) then begin goto a2; k:=i; end; setcolor(white); circle(x,y,10); delay(round(800/v)); setcolor(black); x:=(i-1)*round(v*cos(a*pi/180))+55+j; y:=400+round(-((i-1)*sin(a*pi/180))-h*25+0.005*(i-1)*(i-1)); circle(x,y,10); delay(round(800/v)); end; x:=i*round(v*cos(a*pi/180))+55+j; y:=400+round(-(i*sin(a*pi/180))-h*25+0.005*i*i); setcolor(white); circle(x,y,10); if readkey=#27 then CloseGraph else goto a1; a2: for i:=k to 300 do begin x:=616-(i*round(v*cos(a*pi/180))+55-j); y:=400+round(-(i*sin(a*pi/180))-h*25+0.005*i*i); setcolor(white); circle(x,y,10); delay(round(800/v)); setcolor(black); x:=616-((i-1)*round(v*cos(a*pi/180))+55-j); y:=400+round(-((i-1)*sin(a*pi/180))-h*25+0.005*(i-1)*(i-1)); circle(x,y,10); delay(round(800/v)); end; x:=616-(i*round(v*cos(a*pi/180))+55-j); y:=round(-(i*sin(a*pi/180))-h*25+0.005*i*i); setcolor(white); circle(x,y+400,10); if readkey=#27 then CloseGraph else goto a1; end; end.