delphi怎么生成9位所有字母组合,并保存为TXT文件?
答案:1 悬赏:0 手机版
解决时间 2021-02-13 03:00
- 提问者网友:感性作祟
- 2021-02-12 05:03
delphi怎么生成9位所有字母组合,并保存为TXT文件?
最佳答案
- 五星知识达人网友:杯酒困英雄
- 2021-02-12 05:09
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Timer1: TTimer;
Label5: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
vg_cou:Int64;
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
h,m,s:Integer;
begin
self.vg_cou:=self.vg_cou+1;
h:=self.vg_cou div 3600;
m:=self.vg_cou div 60;
s:=self.vg_cou mod 60;
self.Label5.Caption:=IntToStr(h)+':'+inttostr(m)+':'+inttostr(s);
end;procedure TForm1.Button2Click(Sender: TObject);
var
i,j,m,n:Integer;
s,ss,p:string;
begin
s:='abcdefghijklmnopqrstuvwxyz';
self.Timer1.Enabled:=False;
self.vg_cou:=0;
self.Timer1.Enabled:=true;
for i:=1 to 26 do
begin
p:=s[i];
for j:=2 to 26 do
begin
if j+7>26 then
continue;
ss:=p+copy(s,j,8);
if self.ListBox1.Items.IndexOf(ss)=-1 then
self.ListBox1.Items.Add(ss);
self.Label4.Caption:=IntToStr(self.ListBox1.Items.Count);
application.ProcessMessages;
end;
end;
end;end.
这个是不考虑排列顺序的
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Timer1: TTimer;
Label5: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
vg_cou:Int64;
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
h,m,s:Integer;
begin
self.vg_cou:=self.vg_cou+1;
h:=self.vg_cou div 3600;
m:=self.vg_cou div 60;
s:=self.vg_cou mod 60;
self.Label5.Caption:=IntToStr(h)+':'+inttostr(m)+':'+inttostr(s);
end;procedure TForm1.Button2Click(Sender: TObject);
var
i,j,m,n:Integer;
s,ss,p:string;
begin
s:='abcdefghijklmnopqrstuvwxyz';
self.Timer1.Enabled:=False;
self.vg_cou:=0;
self.Timer1.Enabled:=true;
for i:=1 to 26 do
begin
p:=s[i];
for j:=2 to 26 do
begin
if j+7>26 then
continue;
ss:=p+copy(s,j,8);
if self.ListBox1.Items.IndexOf(ss)=-1 then
self.ListBox1.Items.Add(ss);
self.Label4.Caption:=IntToStr(self.ListBox1.Items.Count);
application.ProcessMessages;
end;
end;
end;end.
这个是不考虑排列顺序的
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯