求助高手
时间:2011-12-20
来源:互联网
我是一个菜鸟,想声明一个程序并且调用它,函数实现的功能是比较三个数的大小,但是不知道怎样声明函数并且怎样调用,在哪个位置写程序,请高手帮我把完整的程序,(从开始到结尾)写一下,小弟感激不尽,,,,
作者: xhudqlg 发布时间: 2011-12-20
这个。。。。。。还是先找pascal的语法看一看吧
作者: sz_haitao 发布时间: 2011-12-20
最好是先学一下语法和如何操作DELPHI。
以下是代码
Delphi(Pascal) code
以下是代码
Delphi(Pascal) code
unit Unit1; interface uses 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.
作者: rocket204 发布时间: 2011-12-21
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28