Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program application;
- uses wincrt;
- Type
- ligne=record
- Num:byte;
- ch:string;
- end;
- mat=array[1..9,1..9] of Char;
- fiche=file of ligne;
- var
- M:mat;
- f:fiche;
- N:byte;
- procedure saisie (var N:byte);
- Begin
- Repeat
- write('n=');
- readln(N);
- until n in[3..9]
- end;
- procedure remp( var M:mat ; N:byte);
- var l,c:byte;
- begin
- Randomize;
- for l:=1 to N do
- begin
- for c:=1 to N do
- Begin
- M[l,c]:=Chr(random(ord('Z')-ord('A')+1) + ord ('A'));
- end;
- end;
- end;
- procedure transfert(M:mat ; var f:fiche; N:byte);
- var l,c:byte; x:ligne;ch1:string;
- begin
- ReWrite(f);
- for l:=1 to n do
- Begin
- ch1:='';
- for c:=1 to n do
- Begin
- ch1:=ch1+M[l,c];
- x.num:=l;
- x.ch:=ch1;
- write(f,x);
- end;
- end;
- close(f);
- end;
- procedure afficher ( var f:fiche);
- var x:ligne;
- Begin
- Reset(f);
- while Not(eof(f)) do
- Begin
- read(f,x);
- writeln(x.num);
- write(x.ch);
- end;
- close(f);
- end;
- Begin
- assign(f,'C:\4SI3\test.dat');
- saisie(N);
- remp(M,N);
- transfert(M,f,N);
- afficher(f);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement