Unit1.~pas
资源名称:xiaobai.rar [点击查看]
上传用户:autowell
上传日期:2022-06-21
资源大小:16754k
文件大小:1k
源码类别:
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;
- Button1: TButton;
- Label2: TLabel;
- Edit6: TEdit;
- Edit7: TEdit;
- Edit8: TEdit;
- Edit9: TEdit;
- Edit10: TEdit;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- array1,array2:array[0..4] of Integer;
- max,i,j:integer;
- begin
- array1[0]:= strtoint(edit1.Text);
- array1[1]:= strtoint(edit2.Text);
- array1[2]:= strtoint(edit3.Text);
- array1[3]:= strtoint(edit4.Text);
- array1[4]:= strtoint(edit5.Text);
- begin
- for i:=0 to Length(array1)-1 do
- for j:=0 to Length(array1)-i-1 do
- begin
- max:=array1[j];
- if max<array1[j+1] then
- max:=array1[j+1]
- end;
- array2[i]:=max;
- end;
- edit6.Text:=inttostr(array2[0]);
- edit7.Text:=inttostr(array2[1]);
- edit8.Text:=inttostr(array2[2]);
- edit9.Text:=inttostr(array2[3]);
- edit10.Text:=inttostr(array2[4]);
- end;
- end.