Unit1.pas
资源名称:xiaobai.rar [点击查看]
上传用户:autowell
上传日期:2022-06-21
资源大小:16754k
文件大小:2k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls;
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- Edit1: TEdit;
- Edit2: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Edit5: TEdit;
- Edit6: TEdit;
- Edit7: TEdit;
- Edit8: TEdit;
- Edit9: TEdit;
- Edit10: TEdit;
- Edit11: TEdit;
- Edit12: TEdit;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- MyArray:array[0..5] of Integer;
- i,j,k:Integer;
- begin
- MyArray[0]:=strtoint(edit1.Text);
- MyArray[1]:=strtoint(edit2.Text);
- MyArray[2]:=strtoint(edit3.Text);
- MyArray[3]:=strtoint(edit4.Text);
- MyArray[4]:=strtoint(edit5.Text);
- MyArray[5]:=strtoint(edit6.Text);
- begin
- for i:=0 to Length(MyArray)-1 do
- begin
- for j:=0 to Length(MyArray)-i-1 do
- begin
- if MyArray[j] >MyArray[j+1] then
- begin
- k:=MyArray[j];
- MyArray[j]:=MyArray[j+1];
- MyArray[j+1]:=k;
- end;
- end;
- end;
- edit7.Text:=inttostr(MyArray[0]);
- edit8.Text:=inttostr(MyArray[1]);
- edit9.Text:=inttostr(MyArray[2]);
- edit10.Text:=inttostr(MyArray[3]);
- edit11.Text:=inttostr(MyArray[4]);
- edit12.Text:=inttostr(MyArray[5]);
- end;
- end;
- end.