注册 登录
编程论坛 Delphi论坛

pascal 使用

fkj_2008 发布于 2007-11-07 01:14, 1780 次点击
学delphi这前要先一些pascal基础.但是对pascal的基本用法如何在delphi环境下应用.如验证两整数交换.可如下:
uses
type point=^integer;
var
p:point;
a,b,c:integer;
begin
a:=100;
b:=50;
p:=@a;
c:=p^;
p^:=b;
b:=c;
end.
请问如何在delphi运行..

5 回复
#2
sky_yang_sky2007-11-07 08:37

看一下delphi就知道了。

#3
fkj_20082007-11-07 11:46
能不能说一下怎样运行它.我才刚刚接触...谢过斑竹先.
#4
sky_yang_sky2007-11-07 15:25

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
point=^integer;
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);


private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;


implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
p:point;
a,b,c:integer;
begin
a:=100;
b:=50;
p:=@a;
c:=p^;
p^:=b;
b:=c;
edit1.text:=inttostr(b);
end;

end.
上面我在form中增加了一個edit1為你顯示數據,變量就看你是要它為全局變量還是局部變量,在這裡我是將它做局部變量用的

#5
城镇农民2007-11-13 08:18
#6
wangguyu2008-05-24 16:40
?
?????
uses
type point=^integer;
var
p:point;
a,b,c:integer;
begin
a:=100;
b:=50;
p:=@a;
c:=p^;
p^:=b;
b:=c;
end.
???
??????
1