标签:
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 47 48 49 50 51 52 53 |
unit XingshiCanshu;
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; lbl3: TLabel; edt3: TEdit; btn1: TButton; procedure btn1Click(Sender: TObject); private { Private declarations } procedure ChangeValue (var i: Integer; var j : Integer); //参数使用变量参数 public { Public declarations } end; var Form5: TForm5; implementation {$R *.dfm} procedure TForm5.btn1Click(Sender: TObject); var x : integer; y : Integer; begin x :=StrToInt( edt1.Text); y := StrToInt(edt2.Text); ChangeValue(x, y); //调用函数之后,x和y的值会被修改 edt3.Text := IntToStr(x + y) ; end; procedure TForm5.ChangeValue(var i : Integer; var j:Integer); // 形参使用变量参数,按地址传递 begin i := i + 10; j := j + 15; end; end. |
标签:
原文地址:http://www.cnblogs.com/kivin/p/4646957.html