
04.05.2011, 14:17
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
ParrayofInteger = ^TarrayofInteger;
TarrayofInteger = array of Integer;
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function sum(a: ParrayofInteger): Integer;
var
i: Integer;
begin
Result:=0;
for i:=Low(a^) to High(a^) do Inc(Result, a^[i]);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
a: TarrayofInteger;
begin
SetLength(a, 3);
a[0]:=100;
a[1]:=200;
a[2]:=300;
ShowMessage(IntToStr(sum(@a)));
end;
end.
__________________
Пишу программы за еду.
__________________
|