Построение кораблика — Pascal(Паскаль)

uses graph, crt;

var
  gd, gm: integer;
  a, h: real;

begin
  initgraph(gd, gm, 'c:\bp\bgi');
  outtextxy(30, 0, 'Введите высоту и длину палубы (H и A через Enter)');
  readln(h);
  readln(a);
  LINE(320 + round(a / 2), 240 - round(h / 2), 320 + round(a / 2),
    240 + round(h / 2));
  LINE(320 + round(a / 2), 240 - round(h / 2), 320 - round(a / 2),
    240 - round(h / 2));
  LINE(320 - round(a / 4), 240 + round(h / 2), 320 + round(a / 2),
    240 + round(h / 2));
  LINE(320 - round(a / 4), 240 + round(h / 2), 320 - round(a / 2),
    240 - round(h / 2));
  LINE(320, 240 - round(h / 2), 320, 240 - round(h * 2));
  LINE(320, 240 - round(h * 2), 320 + round(a / 5), round(240 - h));
  LINE(320, 240 - round(h), 320 + round(a / 5), round(240 - h));
  repeat
    ;
  until keypressed;
  closegraph;

end.

Leave a Comment