文件名称:Delphi 演示0~N位数的任意组合.rar
文件大小:7KB
文件格式:RAR
更新时间:2022-07-30 10:57:38
Delphi源码-其它类别
Delphi 数列的排列组合一例,演示0~N位数的任意组合,组合的数字在0~5之间,需要输入1~6整数,排列结果会显示在文本框组件中。要点代码如下: ssList := TStringList.Create; try if (nBase < 1) then begin end else begin if (sList.Count = 0) then begin for nIdx := 0 to num-1 do ssList.Add(a[nIdx]); end else begin for nIdx := 0 to num-1 do for nSidx := 0 to sList.Count-1 do if (Pos(a[nIdx], sList.Strings[nSidx]) = 0) then ssList.Add(a[nIdx] sList.Strings[nSidx]); end; Combine(nBase-1, ssList); end; if ssList.Count > 0 then begin sList.Clear; sList.Text := ssList.Text;sslist.Count end; finally ssList.Free; end;
【文件预览】:
codesc.net
----TStringList()
--------Project1.res(876B)
--------Unit1.dfm(1KB)
--------Unit1.ddp(51B)
--------Project1.cfg(434B)
--------Unit1.pas(2KB)
--------Project1.dpr(188B)
--------Project1.dof(2KB)
--------Unit1.dcu(6KB)