Тема: [pascal]Graph
Показать сообщение отдельно

  #13  
Старый 20.12.2007, 12:35
r0
Постоянный
Регистрация: 17.07.2005
Сообщений: 475
С нами: 10955906

Репутация: 488
По умолчанию

Ну вот что-то написал, может кто-нибудь поможет дописать? Очень надо =(
Код:
uses crt,graph;
var q,p,err,det,dm,x1,y1,x2,y2,i:integer;

function point(c,d:integer):integer;
begin

putpixel(c,d,2);
delay(10000);

putpixel(c,d,0);
end;

function lie(c,d,e,f:integer):integer;
begin
for i:=c to d do
begin
  delay(1000);
  setcolor(5);
  LineTo(i,d);
  delay(500);
  setcolor(15);
  LineTo(i+5,d);
end;
for i:=d to f do
begin
  delay(1000);
  setcolor(5);
  LineTo(e,i);
  delay(500);
  setcolor(15);
  LineTo(e,i+5);
end;

for i:=e downto c do
begin
  delay(1000);
  setcolor(5);
  LineTo(i,f);
  delay(500);
  setcolor(15);
  LineTo(i-5,f);
end;
for i:=f downto d do
begin
  delay(1000);
  setcolor(5);
  LineTo(c,i);
  delay(500);
  setcolor(15);
  LineTo(c,i-5);
end;


end;


begin
det:=detect;
initgraph(det,dm,'c:\coding\bp\bgi\');
err:=graphresult;
if err<>grOk then writeln(grapherrormsg(err));
readln(x1,y1,x2,y2);
rectangle(x1,y1,x2,y2);

{вычисление приращений для отскока}  
p:=x1;
q:=y1;
repeat
p:=p+1;
q:=q+2;
point(p,q);
if p>=x2 then
p:=p-2;
if q>=y2 then
q:=q-4;

lie(x1,y1,x2,y2);
until keypressed;


readkey;
closegraph;
end.
 
Ответить с цитированием