Помогите сделать подпрограмму с помощью процедуры!!! пожалуйста!!!const CSize1=7;      CSize2=6;      CSize3=5;type TMas1=array[1..CSize1,1..CSize1] of integer;     TMas2=array[1..Csize2, 1..CSize2] of integer;     TMas3=array[...

Помогите сделать подпрограмму с помощью процедуры!!! пожалуйста!!! const  CSize1=7;      CSize2=6;      CSize3=5; type  TMas1=array[1..CSize1,1..CSize1] of integer;     TMas2=array[1..Csize2, 1..CSize2] of integer;      TMas3=array[1..Csize3, 1..CSize3] of integer; var A1:TMas1;    A2:TMas2;     A3:TMas3;     i,j,x, y:byte; function zero(i:integer):boolean; begin zero:=false; if i=0 then zero:=true; end; function interval(i:integer):boolean; begin interval:=false;if (i<=12) and (i>=1) then interval:=true; end; begin X:=0; Y:=0; randomize; for i:=1 to CSize1 do  begin for j:=1 to CSize1 do   begin  A1[i, j]:=random(50);   write(A1[i, j]:3);   if zero(A1[i, j]) then inc(x);   if interval(A1[i,j]) then inc(y);   end;  writeln;  end; writeln('Kol-vo 0 =', x); writeln('Kol-vo v intervale=', y); writeln; x:=0; y:=0; for i:=1 to CSize2 do  begin for j:=1 to CSize2 do   begin  A2[i, j]:=random(50);   write(A2[i,j]:3);   if zero(A1[i,j]) then inc(x);   if interval(A2[i,j]) then inc(y);   end;  writeln;  end; writeln('Kol-vo 0 =', x); writeln('Kol-vo v intervale=', y); writeln; x:=0; y:=0; for i:=1 to CSize3 do  begin for j:=1 to CSize3 do   begin  A3[i, j]:=random(50);   write(A3[i,j]:3);   if zero(A3[i,j]) then inc(x);   if interval(A3[i,j]) then inc(y);   end;  writeln;  end; writeln('Kol-vo 0 =', x); writeln('Kol-vo v intervale=', y); writeln; x:=0; y:=0; end.
Гость
Ответ(ы) на вопрос:
Гость
const       CSize1=7;       CSize2=6;       CSize3=5; type TMas=array[,] of integer;    var     A1:TMas;     A2:TMas;     A3:TMas;     x, y:byte; procedure zapoln(var T:TMas;Size:integer); begin var i,j:integer; setlength(T,Size+1,Size+1); for i:=1 to Size do   begin   for j:=1 to Size do     begin     T[i,j]:=random(50);     write(T[i,j]:3);     end;   writeln;   end; writeln; end; function zero(T:TMas):integer; var i,j,n:integer; begin n:=length(T,0)-1; for i:=1 to n do   for j:=1 to n do     if T[i,j]=0 then result:=result+1; end; function interval(T:TMas):integer; var i,j,n:integer; begin n:=length(T,0)-1; for i:=1 to n do   for j:=1 to n do     if (1<=T[i,j]) and (T[i,j]<=12) then result:=result+1; end; begin zapoln(A1,CSize1); zapoln(A2,CSize2); zapoln(A3,CSize3); x:=zero(A1)+zero(A2)+zero(A3); y:=interval(A1)+interval(A2)+interval(A3); writeln('Kol-vo 0 =', x); writeln('Kol-vo v intervale=', y); end.
Не нашли ответ?
Ответить на вопрос
Похожие вопросы