码迷,mamicode.com
首页 > 其他好文 > 详细

Const

时间:2015-07-14 23:54:20      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

 Pascal Code 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
unit Functioncal;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm5 = 
class(TForm)
    lbl1: TLabel;
    edt1: TEdit;
    lbl2: TLabel;
    edt2: TEdit;
    btn1: TButton;
    lbl3: TLabel;
    edt3: TEdit;
    
procedure btn1Click(Sender: TObject);
    
function ADD(const A: Integerconst B: Integer): Integer;   //常量参数,不能修改参数
  private
    
{ Private declarations }
  
public
    
{ Public declarations }
  
end;

var
  Form5: TForm5;

implementation

{$R *.dfm}
 
function TForm5.ADD(const A: Integerconst B: Integer): Integer;     //常量参数函数实现
 begin
 result := A+ B;
 
end;
procedure TForm5.btn1Click(Sender: TObject);
var
x : 
Integer;
y : 
Integer;
begin
      x := StrToInt(edt1.
Text);
      y := StrToInt(edt2.
Text);
      edt3.
Text := IntToStr(ADD(x,y));  //调用常量参数函数
end;

end.

Const

标签:

原文地址:http://www.cnblogs.com/kivin/p/4646953.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!