|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
小甲鱼老师在函数第三课的作业 交换数据,上交,请小甲鱼老师审批
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(var str_a:string; var 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;
begin
str1:= edit1.Text ;
str2:= edit2.Text ;
swap(str1, str2);
edit1.Text := str1;
edit2.Text := str2;
end;
procedure TForm1.swap(var str_a: string; var str_b: string);
var
temp: string;
begin
temp:= str_a;
str_a:= str_b;
str_b:= temp;
end;
end.
|
|