求助高手
我是一个菜鸟,想声明一个程序并且调用它,函数实现的功能是比较三个数的大小,但是不知道怎样声明函数并且怎样调用,在哪个位置写程序,请高手帮我把完整的程序,(从开始到结尾)写一下,小弟感激不尽,,,,
[解决办法]
这个。。。。。。还是先找pascal的语法看一看吧
[解决办法]
最好是先学一下语法和如何操作DELPHI。
以下是代码
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; function sort(const A,B,C:Integer):string; //排序的函数 procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}{ TForm1 }function TForm1.sort(const A, B, C: Integer): string; //函数的代码begin if A>B then begin if B>C then Result := inttostr(C)+','+inttostr(B)+','+inttostr(A) else if A > C then result:= inttostr(B)+','+inttostr(C)+','+inttostr(A) else result := inttostr(B)+','+inttostr(A)+','+inttostr(C); end else begin if A > C then result := inttostr(C)+','+inttostr(A)+','+inttostr(B) else if B > C then result := inttostr(A)+','+inttostr(C)+','+inttostr(B) else result := inttostr(A)+','+inttostr(B)+','+inttostr(C) end;end;procedure TForm1.Button1Click(Sender: TObject);begin Edit1.Text:=sort(5,8,7); //调用函数end;end.