我
我是一只小小鸟
Unregistered / Unconfirmed
GUEST, unregistred user!
大家看看那里错了
unit Unitx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
pt=^tm;
tm=record
data:integer;
nextt;
end;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
p1,p2t;
i:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
p3t;
begin
i:=i+1;
new(p3);
p3.data:=i;
if p1=nil then
begin
p1:=p3;
p2:=p3;
end
else
begin
p2.next:=p3;
p2:=p3;
end;
p3:=nil;
edit1.Text :=inttostr(i);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
p2:=p1;
while p2<>nil do
begin
edit1.Text :=inttostr(p2.data);
p2:=p2.next;
end;
end;
end.
unit Unitx;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
pt=^tm;
tm=record
data:integer;
nextt;
end;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
p1,p2t;
i:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
p3t;
begin
i:=i+1;
new(p3);
p3.data:=i;
if p1=nil then
begin
p1:=p3;
p2:=p3;
end
else
begin
p2.next:=p3;
p2:=p3;
end;
p3:=nil;
edit1.Text :=inttostr(i);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
p2:=p1;
while p2<>nil do
begin
edit1.Text :=inttostr(p2.data);
p2:=p2.next;
end;
end;
end.