procedure TForm1.Button1Click(Sender: TObject);
var
k, i1, i2, i3, i4, i5, i6, i7, v, Count: integer;
FLine: array of String[2];
FOut: array [1..7] of String[2];
FLines: TStrings;
Str: String;
begin
Count := Memo1.Lines.Count;
SetLength(FLine, Count + 1);
for k := 1 to Countdo
FLine[k] := Memo1.Lines[k - 1];
k := GetTickCount;
v := 0;
FLines := TStringList.Create;
try
for i1 := 1 to Count - 6do
begin
FOut[1] := FLine[i1];
for i2 := i1 + 1 to Count - 5do
begin
FOut[2] := FLine[i2];
for i3 := i2 + 1 to Count - 4do
begin
FOut[3] := FLine[i3];
for i4 := i3 + 1 to Count - 3do
begin
FOut[4] := FLine[i4];
for i5 := i4 + 1 to Count - 2do
begin
FOut[5] := FLine[i5];
for i6 := i5 + 1 to Count - 1do
begin
FOut[6] := FLine[i6];
for i7 := i6 + 1 to Countdo
begin
FOut[7] := FLine[i7];
inc(v);
if v < 500 then
begin
str := Format('%3s%3s%3s%3s%3s%3s%3s',
[FOut[1], FOut[2], FOut[3], FOut[4], FOut[5], FOut[6],
FOut[7]]);
FLines.Add(Str);
end;
end;
end;
end;
end;
end;
end;
end;
Memo2.Lines.Assign(FLines);
finally
FLines.Free;
end;
TButton(Sender).Caption := Format('%6d ms',[integer(GetTickCount) - k]);
Caption := IntToStr(v);
end;