|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
num:Array[1..100]of Integer;
i:Integer=1;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:=label1.Caption+''+Edit1.Text;
num[i]:=StrToInt(Edit1.Text);
i:=i+1;
Edit1.Text:='';
end;
procedure TForm1.Button2Click(Sender: TObject);
var
l,j,k,n:Integer;
begin
For l:=1 to i-1 do
begin
k:=i-l;
For j:=1 to k do
begin
If(num[j]<num[j+1])then
begin
n:=num[j];
num[j]:=num[j+1];
num[j+1]:=n;
end;
end;
end;
label1.Caption:='';
For l:=i-1 Downto 1 do
Label1.Caption:=Label1.Caption+IntToStr(num[l])+'';
end;
end.
感覺for迴圈沒執行
請問是要執行什麼功能??
可以上傳你的檔案嗎
|
|