unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, uTF;
type
TForm1 = class(TForm)
memMsg: TMemo;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
FTFList: TTFList;
procedure DispMsg(AMsg: string);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
uses
Math;
procedure TForm1.Button1Click(Sender: TObject);
var
LTF: TTF;
N1, n2, n3, n4: integer;
sNums: string;
smsg: string;
begin
FTFList.ClearAndFreeAllItems;
Randomize;
N1 := RandomRange(1, 11);
n2 := RandomRange(1, 11);
n3 := RandomRange(1, 11);
n4 := RandomRange(1, 11);
LTF := FTFList.AddNewOne;
LTF.Value := N1;
LTF := FTFList.AddNewOne;
LTF.Value := n2;
LTF := FTFList.AddNewOne;
LTF.Value := n3;
LTF := FTFList.AddNewOne;
LTF.Value := n4;
sNums := N1.ToString + ',' + n2.ToString + ',' + n3.ToString + ',' + n4.ToString;
DispMsg('数字:' + sNums);
LTF := nil;
smsg := DoCount(FTFList);
DispMsg(smsg + '=24');
DispMsg('---------------------------');
end;
procedure TForm1.DispMsg(AMsg: string);
begin
memMsg.Lines.Add(AMsg);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FTFList := TTFList.Create;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FTFList.Free;
end;
end.
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.042752027511597 seconds