program stone;
uses graph;
const BoundX=70;
BoundY=70;
g=9.8;
rad=3.1415/180;
var KX, KY,LX,LY:integer;
HX, HY,DX,DY,HT:real;
XM,YM:integer;
x,y,x0,y0:integer;
i,gr,gm:integer;
v0,alfa:real;
xi,yi:real;
Bmax,Hmax,Tmax:real;
t:real;
Xmax,Ymax:real;
R:real;
S:string[8];
PROCEDURE FXY(T,V0,ALF:REAL; VAR X,Y:REAL);
BEGIN
X:=V0*COS(ALF*RAD)*T;
Y:=V0*SIN(ALF*RAD)*T-G*T*T/2;
END;
BEGIN
WRITE('Введите начальную скоpость ');
readln(v0);
WRITE('Введите угол бpоска ');
readln(alfa);
gr:=detect;
initgraph(gr,gm, ' ');
XM:=GetMaxX; YM:=GetMaxY;
KX:=XM+1-2*BoundX; KY:=YM+1-2*BoundY;
R:=sin(alfa*rad);
Bmax:=v0*v0*sin(2*alfa*rad)/g;
Xmax:=v0*v0/g;
Hmax:=v0*v0*r*r/(2*g);
Ymax:=v0*v0/(2*g);
Tmax:=2*v0*r/g;
hx:=Xmax/(kx-1);
hy:=Ymax/(ky-1);
lx:= kx div 10; ly:=ky div 10;
dx:=Xmax/10; dy:=Ymax/10;
ht:=Tmax/100;
SetBkColor(Cyan);
SetColor(Blue);
LINE(BoundX,BoundY,BoundX, YM-BoundY);
x0:=BoundX; y0:=BoundY;
x:=XM-BoundX; y:=y0;
LINE(BoundX,YM-BoundY,XM-BoundX, YM-BoundY);
x:=0; y:=ym-boundY;
for i:=0 to 10 do
begin
STR ((dy*i):8:2,s);
OutTextXY(x,y,s);
y:=y-ly;
end;
x:=BoundX div 2; y:=ym-BoundY div 2;
for i:=0 to 10 do
begin
STR ((dx*i):8:2,s);
OutTextXY(x,y,s);
x:=x+lx;
end;
STR(Bmax:8:2,s);
OutTextXY(BoundX+20,5, 'Дальность полета: '+s);
STR(Hmax:8:2,s);
OutTextXY(BoundX+20,15, 'Высота подьема: '+s);
SetColor(LightRed);
t:=0;
x0:=BoundX;
y0:=ym-boundY;
while (t<Tmax) do
begin
t:=t+ht;
FXY(t,v0,alfa,xi,yi);
x:=BoundX+round(xi/hx);
y:=ym-BoundY-round(yi/hy);
line(x0,y0,x,y);
x0:=x;
y0:=y;
end;
readln;
closegraph;
end.