Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program exercice7;
- Uses Wincrt;
- Type
- mat = Array [1..99,1..99] Of Integer;
- Var
- l,c: Integer;
- a,max,min: mat;
- Procedure remplir (Var a:mat;Var l,c:Integer);
- Var
- i,j: Integer;
- Begin
- Repeat
- Writeln ('Saisir le nombre de ligne');
- Readln (l);
- Writeln ('Saisir le nombre de collone');
- Readln (c);
- Until (l>0) And (c>0);
- For i:=1 To l Do
- For j:=1 To c Do
- Begin
- Writeln ('A[',i,',',j,'] : ');
- Readln (a[i,j]);
- End;
- End;
- Function maxx (a:mat;i,c:Integer): Integer;
- Var
- j,x: Integer;
- Begin
- x := a[i,1];
- For j:=1 To c Do
- If x<=a[i,j] Then x := a[i,j] ;
- maxx := x;
- End;
- Function minn (a:mat;i,j:Integer): Integer;
- Var
- x,g: Integer;
- Begin
- x := a[i,j];
- For g:=1 To l Do
- If x>a[g,j] Then x := a[g,j] ;
- minn := x;
- End;
- Procedure traitmin (a:mat;Var min:mat;l,c:Integer);
- Var
- i,j,m: Integer;
- Begin
- For i:=1 To l Do
- For j:=1 To c Do
- Begin
- m := minn(a,i,j);
- If a[i,j]<>m Then min[i,j] := 0
- Else min[i,j] := 1;
- End;
- End;
- Procedure traitmax (a:mat;Var max:mat;l,c:Integer);
- Var
- i,j,m: Integer;
- Begin
- For i:=1 To l Do
- Begin
- m := maxx(a,i,c);
- For j:=1 To c Do
- If a[i,j]<>m Then max[i,j] := 0
- Else max[i,j] := 1;
- End;
- End;
- procedure affiche (a,max,min:mat;l,c:integer);
- Var
- m:mat;
- i,j:integer;
- begin
- for i:=1 to l Do
- for j:=1 to c Do
- if (min[i,j]=1) and (max[i,j]=1) Then
- writeln ('A[',i,',',j,'] : ', a[i,j]);
- end;
- Begin
- remplir (a,l,c);
- traitmax (a,max,l,c);
- traitmin (a,min,l,c);
- affiche (a,max,min,l,c);
- End.
Advertisement
Add Comment
Please, Sign In to add comment