Guest User

Untitled

a guest
Jun 13th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.77 KB | None | 0 0
  1. program Project2;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6.   SysUtils;
  7.  
  8. type
  9.   tab = array[byte,byte] of byte;
  10.  
  11. var
  12.   kw:tab;
  13.   p:byte;
  14.   b,i,j:integer;
  15.   jest:boolean;
  16.   plik:file of tab;
  17.  
  18. begin
  19.   Randomize();
  20.   writeln('Podaj bok: ');
  21.   readln(b);
  22.  
  23.   for i:=1 to b do
  24.     for j:=1 to b do
  25.       kw[i,j]:=random(2);
  26.  
  27.   for i:=1 to b do
  28.   begin
  29.     for j:=1 to b do
  30.       write(kw[i,j],' ');
  31.     writeln;
  32.   end;
  33.  
  34.   writeln;
  35.   for j:=1 to b do
  36.   begin
  37.     jest:=true;
  38.     i:=2;
  39.     p:=kw[1,j];
  40.     while (i<=b) and  (jest) do
  41.     begin
  42.       if kw[i,j]<>p then
  43.         jest:=false;
  44.       i:=i+1;
  45.     end;
  46.     if jest then
  47.       write(j,' ');
  48.   end;
  49.  
  50.   assign(plik,'kwadrat.dat');
  51.   rewrite(plik);
  52.   write(plik,kw);
  53.   close(plik);
  54.  
  55.   readln;
  56. end.
Add Comment
Please, Sign In to add comment