SHARE
TWEET

mat_alphabet

M1RAI Oct 10th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. program application;
  2. uses wincrt;
  3. Type
  4. ligne=record
  5. Num:byte;
  6. ch:string;
  7. end;
  8. mat=array[1..9,1..9] of Char;
  9. fiche=file of ligne;
  10. var
  11. M:mat;
  12. f:fiche;
  13. N:byte;
  14.  
  15. procedure saisie (var N:byte);
  16. Begin
  17.     Repeat
  18.         write('n=');
  19.         readln(N);
  20.     until n in[3..9]
  21. end;
  22.  
  23. procedure remp( var M:mat ; N:byte);
  24. var l,c:byte;
  25. begin
  26.     Randomize;
  27.     for l:=1 to N do
  28.         begin
  29.             for c:=1 to N do
  30.                 Begin
  31.                     M[l,c]:=Chr(random(ord('Z')-ord('A')+1) + ord ('A'));
  32.                 end;
  33.         end;
  34. end;
  35.  
  36. procedure transfert(M:mat ; var f:fiche; N:byte);
  37. var l,c:byte; x:ligne;ch1:string;
  38. begin
  39.     ReWrite(f);
  40.     for l:=1 to n do
  41.         Begin
  42.             ch1:='';
  43.             for c:=1 to n do
  44.                 Begin
  45.                     ch1:=ch1+M[l,c];
  46.                     x.num:=l;
  47.                     x.ch:=ch1;
  48.                     write(f,x);
  49.                 end;
  50.         end;
  51.     close(f);
  52. end;
  53.  
  54. procedure afficher ( var f:fiche);
  55. var x:ligne;
  56. Begin
  57.     Reset(f);
  58.     while Not(eof(f)) do
  59.     Begin
  60.         read(f,x);
  61.         writeln(x.num);
  62.         write(x.ch);
  63.     end;
  64.     close(f);
  65. end;
  66.  
  67. Begin
  68. assign(f,'C:\4SI3\test.dat');
  69. saisie(N);
  70. remp(M,N);
  71. transfert(M,f,N);
  72. afficher(f);
  73. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top