Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program nullone;
- uses
- graphabc;
- var
- m: array[1..100] of array [1..100] of integer;
- t: text;
- i, j, ax, ay, k, count, ymax, xmax, k1: integer;
- procedure fill(x, y: integer);
- var
- x1, x2, y1, y2: integer;
- begin
- if (x >= 1) and (y >= 1) and (x <= xmax) and (y <= ymax) then
- begin
- x1 := ay * y;
- y1 := ax * x;
- x2 := x1 + ax;
- y2 := y1 + ay;
- if m[x, y] = 1 then
- begin
- setbrushcolor(clblack);
- Rectangle(x1, y1, x2, y2);
- end;
- if m[x, y] = 0 then
- begin
- setbrushcolor(clwhite);
- Rectangle(x1, y1, x2, y2);
- end;
- if y < ymax then
- begin
- sleep(10);
- fill(x, y + 1);
- end;
- if (y = ymax) and (x < xmax) then
- begin
- sleep(10);
- fill(x + 1, y - y + 1);
- end;
- end;
- end;
- begin
- writeln('Программа закрашивает матрицу, единицы - чёрным, нули - белым');
- ax := 30;
- ay := 30;
- assign(t, 'input.txt');
- reset(t);
- count := 0;
- while not eoln(t) do
- begin
- read(t, k);
- inc(count);
- end;
- close(t);
- reset(t);
- for i := 1 to count do
- begin
- for j := 1 to count do
- read(t, m[i, j]);
- end;
- ymax := j;
- xmax := i;
- i := 1;
- j := 1;
- if k1 = 0 then
- fill(i, j)
- else
- writeln('На границе матрицы должны быть 1');
- close(t);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement