
11.02.2015, 14:13
|
 |
Новичок
|
|
Регистрация: 03.02.2011
Сообщения: 79
Репутация: -2306
|
|
Передача массива в функцию
Всем привет. Не уверен, но всё же надеюсь что вы сможете мне в этом помочь.
Вот сам код:
PHP код:
program Project5;
{$APPTYPE CONSOLE}
uses
SysUtils;
type ArrayOfByte = Array Of Byte;
Function math1(Const a: Array Of Byte): Integer;
Var Index: Integer;
Begin
Result := 0;
for Index := Low(a) to high(a) do
Inc(Result, a[Index]);
End;
Function math2(Const a: ArrayOfByte): Integer;
Var Index: Integer;
Begin
Result := 0;
for Index := Low(a) to high(a) do
Inc(Result, a[Index]);
End;
begin
Writeln('Math1: '+IntToStr(Math1([1,2,3,4,5,6,7,8,9])));
// Writeln('Math2: '+IntToStr(Math2([1,2,3,4,5,6,7,8,9])));
sleep(5000);
end.
Подскажите, что нужно для того, чтоб функцию Math2 можно было бы вызвать как Math1 и возможно ли вообще что то реализовать подобное ?
|