我是一个菜鸟,想声明一个程序并且调用它,函数实现的功能是比较三个数的大小,但是不知道怎样声明函数并且怎样调用,在哪个位置写程序,请高手帮我把完整的程序,(从开始到结尾)写一下,小弟感激不尽,,,,
解决方案 »
- 如何设置Delphi7调用WebServices超时时间
- 急求delphi软件工程师(要求具有网络通讯经验,待遇优厚) 武汉
- delphi写的ActiveX控件,怎么才能使其在运行时不可见?
- 怎么让fastreport 打印的一项 内容 值为 外面可输入框的值?
- 关于日期计算的问题,求教
- 控制外部软件的启动及运行,如何将它的闪现窗体也隐藏呢?
- 初学三层开发,一般的数据库操作已经可以了,如果把图片保存到数据库中怎么也搞不出来
- 关于用delphi编制的数据库程序是否能够单独运行?
- 嵌套查询的密码问题
- 请问如何给一个字符串变量划分21000字节??
- 请问超大屏幕全屏也是wsMaximized就可以全屏吗?
- Delphi7怎么没有msodsapi.dcu?
以下是代码
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.