unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Edit3: TEdit;
edit4: TEdit;
memo1: TMemo;
procedure Button1Click(Sender: TObject);
// procedure Edit3Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
mystr: Integer;
i, j, a, b, f, o, q: Integer;
out2, c, d, e, g, p, r: string;begin
memo1.Text := '';
a := strtoint(edit1.Text);
j := strtoint(edit2.Text);
o := strtoint(edit3.Text);
q := strtoint(edit4.Text);
b := 1;
for i := 1 to j do
begin c := inttostr(i);
d := inttostr(b);
p := inttostr(o);
r := inttostr(q);
f := 1; for f := a to j do
begin
if f <= b and f <= q then begin
mystr := f * b;
out2 := inttostr(mystr);
g := inttostr(f);
e := e + g + '*' + d + '=' + out2 + ' ' + '';
end
end;
b := b + 1;
memo1.lines.add(e);
e := ''; end;
end;
end.
如何把这个算法封装成可调用的函数?题小分少,多谢赐教!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Edit3: TEdit;
edit4: TEdit;
memo1: TMemo;
procedure Button1Click(Sender: TObject);
// procedure Edit3Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
mystr: Integer;
i, j, a, b, f, o, q: Integer;
out2, c, d, e, g, p, r: string;begin
memo1.Text := '';
a := strtoint(edit1.Text);
j := strtoint(edit2.Text);
o := strtoint(edit3.Text);
q := strtoint(edit4.Text);
b := 1;
for i := 1 to j do
begin c := inttostr(i);
d := inttostr(b);
p := inttostr(o);
r := inttostr(q);
f := 1; for f := a to j do
begin
if f <= b and f <= q then begin
mystr := f * b;
out2 := inttostr(mystr);
g := inttostr(f);
e := e + g + '*' + d + '=' + out2 + ' ' + '';
end
end;
b := b + 1;
memo1.lines.add(e);
e := ''; end;
end;
end.
如何把这个算法封装成可调用的函数?题小分少,多谢赐教!
解决方案 »
- 字符表达式 如何才能转换成 数值型数据?
- 如何计算出两个日期之间有多少个工作日?
- 有句SQL语句大家帮忙改改!高分相送(急)
- 请问一个关于adotable1中焦点移动的问题
- 本人急求一份Seagate Crystal Reports 7.0(水晶报表)安装,谢谢!哪位仁兄有的话加QQ147040054 谢谢!
- 库存管理中‘先进先出’应怎么写最好!
- 有哪位可以把ERP中 [付款期] 這個概念對我進行詳細的破析? (有答必給分)
- 求救:如何将此vc的回调函数改为delphi?
- 如何接收发送给计算机串口的数据,最好有例子 (Email: [email protected])
- 求Delphi XE7下android5.0的补丁
- 截取:字符串问题
- 有函数可以在创建文件夹的同时创建其子文件夹吗?
只是封装算法还是窗体,你说的不清楚。