Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 21st, 2012  |  syntax: None  |  size: 2.25 KB  |  hits: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. uses crt;
  2.  
  3. type
  4.  mas=array[1..20,1..20] of integer;
  5.  
  6. function VvodOfLines:integer;
  7.  var
  8.   s:string;
  9.   n,cod:integer;
  10.  begin
  11.   repeat
  12.    writeln('enter, please');
  13.    readln(s);
  14.    val(s,n,cod);
  15.    if (cod<>0) then
  16.     writeln('you can enter only numbers, which are above zero. Correct it, please')
  17.   until (n>0);
  18.   VvodOfLines:=n;
  19.  end;
  20.  
  21. function VvodOfColomnes:integer;
  22.  var
  23.   s:string;
  24.   n,cod:integer;
  25.  begin
  26.   repeat
  27.    writeln('enter, please');
  28.    readln(s);
  29.    val(s,n,cod);
  30.    if (cod<>0) then
  31.     writeln('you can enter only numbers, which are above zero. Correct it, please')
  32.   until (n>0);
  33.   VvodOfColomnes:=n;
  34.  end;
  35.  
  36. function ArayAdding(b,c:integer):mas;
  37.   var
  38.    i,j,n,cod:integer;
  39.    s:string;
  40.    a:mas;
  41.   begin
  42.    for i:=1 to b do
  43.     begin
  44.      for j:=1 to c do
  45.       begin
  46.        repeat
  47.         writeln('enter element with index ',i,' ',j,' please');
  48.         readln(s);
  49.         val(s,n,cod);
  50.         if cod<>0 then
  51.          writeln('you can enter only numbers. Correct it, please');
  52.        until cod=0;
  53.        a[i,j]:=n;
  54.       end;
  55.     end;
  56.    ArayAdding:=a;
  57.   end;
  58.  
  59. procedure ShowingOfArray(b,c:integer; var a:mas);
  60.  var
  61.   i,j:integer;
  62.  begin
  63.   for i:=1 to b do
  64.    begin
  65.     for j:=1 to c do
  66.      write(a[i,j], ' ');
  67.      writeln;
  68.    end;
  69.  end;
  70.  
  71.  procedure Quantity(b,c:integer; var a:mas);
  72.  var
  73.   i,j,zero,nezero:integer;
  74.  begin
  75.   for i:=1 to b do
  76.    for j:=1 to c do
  77.     if (a[i,j]=0) then
  78.      zero:=zero+1
  79.     else
  80.      nezero:=nezero+1;
  81.   writeln('quontity of elements which are zero ', zero);
  82.   writeln('quontity of elements which are not zero ',nezero);
  83.  end;
  84.  
  85.  function MinMultiplication(b,c:integer; a:mas):integer;
  86.  var
  87.   i,j,p,pmin:integer;
  88.  begin
  89.   p:=1;
  90.   for j:=1 to b do
  91.    begin
  92.      for i:=1 to c do
  93.       p:=p*a[i,j];
  94.      if j=1 then
  95.       pmin:=p
  96.      else
  97.       if p<pmin then
  98.        pmin:=p
  99.    end;
  100.   writeln('minimun multiplication of colomnes ',pmin);
  101.  end;
  102.  
  103.  begin
  104.   clrscr;
  105.   VvodOfLines;
  106.   VvodOfColomnes;
  107.   ArayAdding(VvodOfLines,VvodOfColomnes);
  108.   ShowingOfArray(VvodOfLines, VvodOfColomnes, ArayAdding);
  109.   Quantity(VvodOfLines,VvodOfColomnes,ArayAdding);
  110.   MinMultiplication(VvodOfLines,VvodOfColomnes,ArayAdding);
  111.   readln;
  112.  end;