1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
procedure TF_principale.Button5Click(Sender: TObject);
procedure affiche(nb : integer; tab : array of integer);
begin
if tab[0] < nb then begin
if tab[0] <> tab[1] then begin
if tab[0] <> tab[2] then begin
if tab[0] <> tab[3] then begin
if tab[1] < nb then begin
if tab[1] <> tab[2] then begin
if tab[1] <> tab[3] then begin
if tab[2] < nb then begin
if tab[2] <> tab[3] then begin
if tab[3] < nb then begin
memo2.lines.add(inttostr(tab[0]) + ' - ' +inttostr(tab[1])+ ' - ' +inttostr(tab[2])+'- '+inttostr(tab[3]));
inc(tab[3]);
affiche(nb,tab );
end else begin
inc(tab[2]);
tab[3] := 0;
affiche(nb,tab);
end;
end else begin
inc( tab[3]);
affiche(nb,tab);
end;
end else begin
inc(tab[1]);
tab[2] := 0;
tab[3] := 0;
affiche(nb,tab);
end;
end else begin
inc( tab[3]);
affiche(nb,tab);
end;
end else begin
inc( tab[2]);
affiche(nb,tab);
end;
end else begin
inc(tab[0]);
tab[1] := 0;
tab[2] := 0;
tab[3] := 0;
affiche(nb,tab);
end;
end else begin
inc(tab[3]);
affiche(nb,tab);
end;
end else begin
inc(tab[2]);
affiche(nb,tab);
end;
end else begin
inc(tab[1]);
affiche(nb,tab);
end;
end;
end;
var
tableau : array of integer;
begin
memo2.clear;
setlength(tableau, 4);
tableau[0] := 0;
tableau[1] := 0;
tableau[2] := 0;
tableau[3] := 0;
affiche(4,tableau);
end; |
Partager