?? younger.~pas
字號:
unit younger;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label1: TLabel;
Label2: TLabel;
Memo1: TMemo;
Button4: TButton;
Edit1: TEdit;
Memo2: TMemo;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
YoungerList:array[0..20] of array [0..20] of integer;
SourceList:array[0..20] of integer;
NoteList:array[0..20] of array [0..20] of integer;
Str1:string;
i,j:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
m:integer;
begin
Str1:=edit1.Text;
for m:=1 to length(str1) do
begin
SourceList[m]:= StrtoIntDef(str1[m],0);
if SourceList[m]=0then
if Str1[m]='A' then
SourceList[m]:=10
else if Str1[m]='B' then
SourceList[m]:=11
else if str1[m]='C' then
SourceList[m]:=12
else if str1[m]='D' then
SourceList[m]:=13
else if Str1[m]='E' then
SourceList[m]:=14
else if Str1[m]='F'then
SourceList[m]:=15
else if str1[m]='G' then
SourceList[m]:=16
else if str1[m]='H' then
sourceList[m]:=17
else if str1[m]='I'then
SourceList[m]:=18
else if str1[m]='J'then
Sourcelist[m]:=19
else
sourceList[m]:=20;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
for i:=0 to 10 do
begin
for j:=0 to length(str1) do
begin
if YoungerList[i][j]<>0 then
begin
Memo1.Text:=Memo1.Text+InttoStr(YoungerList[i][j])+' ';
Memo2.Text:=Memo2.Text+InttoStr(NoteList[i][j])+' ';
end
else begin
memo1.Text:=memo1.Text+#13#10;
Memo2.Text:=Memo2.Text+#13#10;
end;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
a,b,c,d,i,j:integer;
begin
YoungerList[0][0]:=SourceList[0];
NoteList[0][0]:=1;
d:=1;
for a:=1 to length(str1) do
begin
b:=SourceList[a];
i:=0;
j:=0;
while b<>0 do
begin
if YoungerList[i][j]<>0 then
if b>YoungerList[i][j] then
j:=j+1
else begin
c:=YoungerList[i][j];
YoungerList[i][j]:=b;
b:=c;
i:=i+1;
j:=0;
end
else begin
YoungerList[i][j]:=b;
NoteList[i][j]:=d;
d:=d+1;
b:=0;
end;
end;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -