Exercice 1 ab

program ex1_ab;
type
mat = array[1..2, 1..2] of boolean;
arrmat = array[1..16] of mat;
var
m: arrmat;
i: integer;

procedure init (var a: arrmat);
var
i, j, k, n, x: integer;
begin
x := 1;
for i := 1 to 2 do
for j := 1 to 2 do
for k := 1 to 2 do
for n := 1 to 2 do
begin
a[x][1, 1] := i = 1;
{ si i=1 renvoie true sinon renvoie false }
a[x][1, 2] := j = 1;
a[x][2, 1] := k = 1;
a[x][2, 2] := n = 1;
x := x + 1;
end;
end;
{ Fin de 'init' }

begin (* CORPS DU PROGRAMME *)
writeln('Ex1 a-b www.Software-DS.com');
writeln('Soit une matrice de dimension 2x2 dont');
writeln('le contenu est ''true'' ou ''false''');
writeln('Il y a 16 matrices distinctes possibles.');
writeln('Ce programme va calculer ces matrices.');
writeln;
init(m);

{ Cette partie affiche les matrices. Ce n'etait pas demande au partiel :-( }
for i := 1 to 16 do
begin
writeln('[', m[i][1, 1], ',', m[i][1, 2], ']');
writeln('[', m[i][2, 1], ',', m[i][2, 2], ']');
writeln;
end;

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.





Haut de la page - Page générée en 0.00208 sec.
 

1845839 visiteurs.   ©2001-2024 All Rights Reserved to Software-DS.com
Made with a mac  
Confidentialité