Einzelnen Beitrag anzeigen

danten

Registriert seit: 19. Feb 2012
Ort: Czech Republic, Prag
126 Beiträge
 
Delphi 10.1 Berlin Architect
 
#3

AW: Generation of Multiple Set Combinations

  Alt 21. Nov 2017, 11:48
Thank you,
the problem is to load the array array from edit.

Code:
Delphi-Quellcode:
procedure TFormGenerate.Generate;
var
  i1,i2,i3 : Integer;
  array1,array2,array3: array of string;
begin
  array1 := [editArray1.Text];
  array2 := [editArray2.Text];
  array3 := [editArray3.Text];

  for I1 := Low(Array1) to High(Array1) do
  for I2 := Low(Array2) to High(Array2) do
    for I3 := Low(Array3) to High(Array3) do
      Memo1.Lines.Add(Format('%s-%s-%s', [Array1[I1], Array2[I2], Array3[I3]]));
end;
Result = A,B,C,D-1,2,3,4,5,6-X1,X2

Delphi-Quellcode:
procedure TForm27.Generate;
var
  i1,i2,i3 : Integer;
  array1,array2,array3: array of string;
begin
  array1 := ['A','B'];
  array2 := ['1','2','3'];
  array3 := ['X1','X2'];

  for I1 := Low(Array1) to High(Array1) do
  for I2 := Low(Array2) to High(Array2) do
    for I3 := Low(Array3) to High(Array3) do
      Memo1.Lines.Add(Format('%s-%s-%s', [Array1[I1], Array2[I2], Array3[I3]]));
end;
Result =
A-1-X1
A-1-X2
A-2-X1
...
B-2-X2
B-3-X1
B-3-X2
Daniel
  Mit Zitat antworten Zitat