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