求助贴
delphi吧
全部回复
仅看楼主
level 4
一楼不说事[阴险]
2016年07月25日 08点07分 1
level 4
楼主是初学者,想搞个关与一道数学学题的小工具(如下图)界面大概是这样的(没有优化)但是按了f9以后点ok没有反应,求助为什么?
2016年07月25日 08点07分 2
楼下代码
2016年07月25日 08点07分
level 4
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
ok: TButton;
Label3: TLabel;
procedure OKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.okClick(Sender: TObject);
var
a,b:integer; c,d,e:real;
begin
b:=strtoint(edit1.Text);
a:=strtoint(edit2.Text);
d:=-1;
if (a<=0)or(b<=0)
then
label3.caption:='你做个这样的图形看看?'
else
if
a=b
then
label3.caption:='这是正方形!'
else
while
(a*b<>0)
do
begin
c:=a/b; e:=trunc(c);
a:=b; b:=a mod b;
d:=d+e;
end;
label3.caption:='这个长方形是'+floattostr(d)+'阶方形'
end;
end.
2016年07月25日 08点07分 3
level 4
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
ok: TButton;
Label3: TLabel;
procedure OKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.okClick(Sender: TObject);
var
a,b:integer; c,d,e:real;
begin
b:=strtoint(edit1.Text);
a:=strtoint(edit2.Text);
d:=-1;
if (a<=0)or(b<=0)
then
label3.caption:='你做个这样的图形看看?'
else
if
a=b
then
label3.caption:='这是正方形!'
else
while
(a*b<>0)
do
begin
c:=a/b; e:=trunc(c);
a:=b; b:=a mod b;
d:=d+e;
end;
label3.caption:='这个长方形是'+floattostr(d)+'阶方形'
end;
end.
2016年07月25日 08点07分 5
2016年07月25日 12点07分
level 8
这 哎 静心看书 轻松解决
2016年07月25日 09点07分 6

2016年07月25日 09点07分
1