Язык:
Русский
English
{ Пример программы для процедуры Rectangle }
uses Crt, Graph;
var
GraphDriver, GraphMode : Integer;
X0, Y0, X1, Y1, X2, Y2 : Integer;
begin
GraphDriver := Detect;
InitGraph(GraphDriver, GraphMode, 'X:\BP');
if GraphResult <> grOk then
Halt(1);
X0 := GetMaxX;
Y0 := GetMaxY;
Randomize;
repeat
X1 := Random(X0);
Y1 := Random(Y0);
X2 := Random(X0 - X1) + X1;
Y2 := Random(Y0 - Y1) + Y1;
Rectangle(X1, Y1, X2, Y2);
until KeyPressed;
CloseGraph;
end.
var
GraphDriver, GraphMode : Integer;
X0, Y0, X1, Y1, X2, Y2 : Integer;
begin
GraphDriver := Detect;
InitGraph(GraphDriver, GraphMode, 'X:\BP');
if GraphResult <> grOk then
Halt(1);
X0 := GetMaxX;
Y0 := GetMaxY;
Randomize;
repeat
X1 := Random(X0);
Y1 := Random(Y0);
X2 := Random(X0 - X1) + X1;
Y2 := Random(Y0 - Y1) + Y1;
Rectangle(X1, Y1, X2, Y2);
until KeyPressed;
CloseGraph;
end.