Const
nn=20;
var
d:array[1..nn,1..nn] of integer;
zr,zc:array[1..nn] of boolean; { строки и столбцы }
n,m,i,j,nr,nc:integer;
begin
Write('Укажите n и m: '); Read(n,m);
Randomize;
Writeln('И с х о д н ы й м а с с и в');
nr:=0; nc:=0;
for i:=1 to n do zr[i]:=False;
for j:=1 to m do zc[j]:=False;
for i:=1 to n do begin
for j:=1 to m do begin
d[i,j]:=Random(21)-10;
Write(d[i,j]:4);
if d[i,j]=0 then begin zr[i]:=True; zc[j]:=True end;
end;
Writeln
end;
for i:=1 to n do
if zr[i] then
for j:=1 to m do d[i,j]:=0;
for j:=1 to m do
if zc[j] then
for i:=1 to n do d[i,j]:=0;
Writeln('М а с с и в - р е з у л ь т а т');
for i:=1 to n do begin
for j:=1 to m do Write(d[i,j]:4);
Writeln
end
end.
Пример
Укажите n и m: 7 12
И с х о д н ы й м а с с и в
-10 8 -4 -3 -8 9 1 -6 4 -6 5 -1
-8 -2 -8 -7 -3 -1 4 4 5 -1 7 -6
8 -5 8 -1 -8 9 8 -4 -6 -2 0 4
7 -4 8 -9 3 2 9 3 3 6 9 4
9 -3 8 8 -4 9 7 2 -10 -8 -1 8
-10 -8 -8 6 -4 -2 -6 4 8 -1 -3 -9
2 2 -9 -7 0 -6 2 -9 -4 -6 0 5
М а с с и в - р е з у л ь т а т
-10 8 -4 -3 0 9 1 -6 4 -6 0 -1
-8 -2 -8 -7 0 -1 4 4 5 -1 0 -6
0 0 0 0 0 0 0 0 0 0 0 0
7 -4 8 -9 0 2 9 3 3 6 0 4
9 -3 8 8 0 9 7 2 -10 -8 0 8
-10 -8 -8 6 0 -2 -6 4 8 -1 0 -9
0 0 0 0 0 0 0 0 0 0 0 0
В ячейке D выйдут результаты, полученные по формулам из столбца С.
В D1: 135 (результат сложения чисел 110 и 25)
В D2: 100 (чисел 45 и 55)
В D3: 180 (чисел 120 и 60)
вроде бы как правильно...
Uses
GraphABC;
var
x, y: word;
i: byte;
begin
SetBrushStyle(bsclear);
SetWindowWidth(590);
SetWindowHeight(390);
Rectangle(5, 5, 585, 385);
x := 25;
y := 25;
Circle(565, 25, 20);
Circle(565, 365, 20);
Circle(25, 365, 20);
repeat
Circle(x, y, 20);
if (x < 565) and (y = 25) then x := x + 20;
if (x = 565) and (y < 365) then y := y + 20;
if (y = 365) and (x > 25) then x := x - 20;
if (x = 25) and (y > 25) then y := y - 20;
until (x = 25) and (y = 25);
Rectangle(50, 50, 540, 340);
x := 115;
for i := 1 to 8 do
begin
Circle(x, 210, 6);
Circle(x, 210, 40);
Circle(x, 210, 45);
x := x + 51;
end;
x := 95;
for i := 1 to 11 do
begin
y := 130;
Line(x, y, x, y - 30);
y := y - 30;
Line(x, y, x + 30, y);
x := x + 30;
Line(x, y, x, y + 25);
y := y + 25;
Line(x, y, x - 20, y);
x := x - 20;
Line(x, y, x, y - 15);
y := y - 15;
Line(x, y, x + 10, y);
x := x + 10;
Line(x, y, x, y + 8);
y := y + 8;
Line(x, y, x - 3, y);
x := x - 3;
Line(x, y, x, y - 4);
y := y - 4;
Line(x, y, x - 3, y);
x := x - 3;
Line(x, y, x, y + 7);
y := y + 7;
Line(x, y, x + 10, y);
x := x + 10;
Line(x, y, x, y - 15);
y := y - 15;
Line(x, y, x - 18, y);
x := x - 18;
Line(x, y, x, y + 24);
y := y + 24;
Line(x, y, x + 30, y);
x := x + 30;
end;
end<span>.</span>