Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program bac2014;
- Uses Wincrt;
- Type
- tab = Array [0..10,0..10] Of Integer;
- tib = Array [1..9] Of Integer;
- Var
- f: Text;
- t,t2: tab;
- Procedure creation (Var f:Text);
- Begin
- Assign (f,'c:\bac\Matrice_aléatoire.txt');
- End;
- Procedure remplir (Var f:Text;Var t:tab);
- Var
- i,j: Integer;
- Begin
- Reset (f);
- For i:=1 To 5 Do
- For j:=1 To 6 Do
- Readln (f,t[i,j]);
- Close (f);
- End;
- Procedure tri_bulle (Var t3:tib;n:Integer);
- Var
- i,aux:integer;
- Begin
- Repeat
- For i:=1 To n-1 Do
- If t3[i]<t3[i+1] Then
- Begin
- aux := t3[i];
- t3[i] := t3[i+1];
- t3[i+1] := aux;
- End;
- n := n-1;
- Until n=0;
- End;
- Procedure decomp (t:tab;n,m:Integer;Var t3:tib);
- Var
- i,j,x: Integer;
- Begin
- x := 0;
- For i:=n-1 To n+1 Do
- For j:=m-1 To m+1 Do
- Begin
- x := x+1;
- t3[x] := t[i,j];
- End;
- End;
- Procedure traitement (t:tab;Var t2:tab);
- Var
- i,j: Integer;
- t3: tib;
- Begin
- For i:=1 To 5 Do
- For j:=1 To 6 Do
- Begin
- decomp (t,i,j,t3);
- tri_bulle (t3,9);
- t2[i,j] := t3[5];
- End;
- For i:=1 To 5 Do
- Begin
- Writeln;
- For j:=1 To 6 Do
- Write (t2[i,j],' | ');
- End;
- End;
- Begin
- creation (f);
- remplir (f,t);
- traitement(t,t2);
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement