|
发表于 2016-5-11 11:09:49
|
显示全部楼层
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Swap_fun ( var str_a, str_b: String );
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
str1: String;
str2: String;
temp: String;
begin
str1:=Edit1.Text;
str2:=Edit2.Text;
Swap_fun(str1, str2);
Edit1.Text:=str1;
Edit2.Text:=str2;
end;
procedure TForm1.Swap_fun ( var str_a, str_b: String );
var
temp: String;
begin
temp:= str_a;
str_a:= str_b;
str_b:= temp;
end;
end.
新人上路,不知道往哪贴! |
|