program ex1_c;
type
mat = array[1..2, 1..2] of boolean;
var
m1, m2: mat;
i, j: integer;
function egalite (m, mm: mat): boolean;
begin
egalite := (m[1, 1] = mm[1, 1]) and
(m[1, 2] = mm[1, 2]) and (m[2, 1] =
mm[2, 1]) and (m[2, 2] = mm[2,
2]);
end; { Fin de
'egalite' }
begin
writeln('Exercice 1 c www.Software-DS.com');
writeln('Soit 2 matrices de dimension 2x2, m et mm');
writeln('Le contenu de chaque élément est
''true'' ou ''false''');
writeln('On veut savoir si ces 2 matrices sont identiques
?');
writeln;
{ Cette partie
n'était pas au partiel mais permet de verifier le bon
fonctionnement de la fonction ! }
m1[1, 1] := true;
m1[1, 2] := true;
m1[2, 1] := true;
m1[2, 2] := false;
{ initialisation des 2 matrices. }
m2[1, 1] := true;
m2[1, 2] := true;
m2[2, 1] := true;
m2[2, 2] := false;
{ Affichage des
2 matrices }
for i := 1 to 2 do
writeln('[', m1[i, 1], ',', m1[i, 2],
'] ', '[', m2[i, 1], ',', m2[i, 2],
']');
writeln;
writeln('Les deux matrices sont égales: ',
egalite(m1, m2));
writeln;
writeln('©2001 All Rights Reserved to
www.Software-DS.com');
{ ©2001 All
Rights Reserved to
http://www.Software-DS.com 06/11/01
}
end.
|