unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations } public
{ Public declarations }
end;var
Form1: TForm1;
procedure abc(length,width:integer);
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
length,width:integer;
begin
length:=strtoint(edit1.text);
width:=strtoint(edit2.text);
abc(length,width);
end;procedure abc(a:integer;b:integer);var
s:integer;
begin
s:=a*b;
form1.edit3.Text:=inttostr(s);
//a:=a*2;
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations } public
{ Public declarations }
end;var
Form1: TForm1;
procedure abc(length,width:integer);
implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
length,width:integer;
begin
length:=strtoint(edit1.text);
width:=strtoint(edit2.text);
abc(length,width);
end;procedure abc(a:integer;b:integer);var
s:integer;
begin
s:=a*b;
form1.edit3.Text:=inttostr(s);
//a:=a*2;
end;end.
Form1: TForm1;
procedure abc(a:integer;b:integer);
procedure TForm1.Button1Click(Sender: TObject);Delphi中,被调用的函数要放在前面。
Form1: TForm1;
procedure abc(length,width:integer);
implementation
非form1内的函数不能在这里声明吧》?!这又不是C++