菜鸟求助,请教各位老师帮忙改一下22课的源码!
本帖最后由 学习中-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. 本帖最后由 学习中-2 于 2013-7-8 01:12 编辑
原来是自己看教程没认真,少了个Var,:(
页:
[1]