|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 学习中-2 于 2013-7-7 23:42 编辑
22课的源码我下载后一直没改好,请给为老师看看,为什么不能交换呢?
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(str_a:String;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(str_a:String; str_b:String);
var
temp:string;
begin
temp:= str_a;
str_a:= str_b;
str_b:= str_a;
end;
end. |
|