program vectorial_physics;
uses graph, crt;
const
n = 1 ;
grDriver : integer = Detect ;
type
{------------speed-----------------------------}
rate = record
Vx, Vy, V : real ;
V0x, V0y : real ;
end ;
{------------coordinate-------------------------}
coordinate = record
x, y : real ;
x0, y0 : real ;
xBlack , yBlack : integer ;
end ;
{-----------------acceleration----------------------------}
acceleration = record
G : real ;
end ;
{-------------------------------var------------------}
var
speed : rate ;
coord : coordinate ;
accel : acceleration ;
time, grMode : integer ;
{--------------------deskription--------------------------}
procedure description ;
begin
writeln(' Ïðîãðàììà ìîäåëèðóþùÿÿ ïîëåò íàä çåìëåé.');
writeln('------------------------------------------ ');
delay(2000);
writeln(' Óïðàâëåíèå : ');
writeln(' Êóðñîðíûå êëàâèøè çàäàþò V è åå íàïðàâëåíèå. ');
writeln(' < HOME > ïàóçà, äëÿ ñíÿòèÿ ïàóçû íàæìèòå ëþáóþ êëàâèøó. ');
writeln(' < END > âûõîä. ') ;
writeln('------------------------------------------ ');
writeln(' Âðåìåííàÿ òåõ. íàêëàäêà : ïåðåòàùèòå ýòî îêíî íà êðàé ð/ñ ');
writeln('------------------------------------------ ');
writeln(' press any key. ') ;
readkey ;
end ;
{-------------------procedure cursor--keys---------}
procedure cursor_keys ;
const
step = 5 ;
var
key : char ;
begin
if keypressed = true then
begin
with speed do
begin
key := readkey ;
case ord (key) of
77 : Vx := Vx + step ; { âïðàâî }
75 : Vx := Vx - step ; { âëåâî }
72 : V := V - step ; { ââåðõ }
80 : V := V + step ; { âíèç }
71 : readkey ; { pause }
79 : halt ; {âûõîä}
end ;
end ;
end;
end ;
{-----------------------calculation of speed-----------------}
procedure calculation_speed ( t : integer ) ;
begin
speed.Vy := speed.V + speed.V0y + accel.G * t ;
writeln(speed.Vy);
writeln('');
end ;
{--------------------------coordinata----------------------}
procedure coordinat (t : integer ) ;
begin
{---part x-}
coord.x := coord.x0 + speed.Vx * t ;
coord.x0 := coord.x ;
{---part y-}
coord.y := coord.y0 + speed.Vy * t + (accel.G * t * t) / 2 ;
coord.y0 := coord.y ;
end ;
{-------------------------------prisvaivanie--------------------------}
procedure prisvaivanie ;
begin
with speed do
begin
V := 0 ;
V0y := 0 ;
end ;
accel.G := 0.5 ;
coord.x0 := 500 ;
coord.y0 := 50 ;
end ;
{------------------------main programm--------------------}
BEGIN
clrscr ;
description ;
prisvaivanie ;
time := 0;
InitGraph (grDriver, grMode, '') ;
while (true) do
begin
delay(100);
inc (time) ;
cursor_keys ;
calculation_speed(time) ;
coordinat(n) ;
setColor(0);
ellipse(coord.xBlack,coord.yBlack,0,359,50,20);
setcolor(15);
ellipse(round(coord.x),round(coord.y),0,359,50,20);
coord.xBlack := round(coord.x);
coord.yBlack := round(coord.y);
Arc(coord.xBlack,coord.yBlack,0,360,10);
end;
END.
Мои вопросы :
1. Правильно ли ?;
{я новичок и это 1ая более менее серьезная прога}