This repository has been archived on 2024-12-25. You can view files and clone it, but cannot push or open issues or pull requests.
2024-03-10 20:32:51 +03:00

27 lines
594 B
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Процедурная переменная как параметр
procedure for_each(a: array of real; p: procedure(var r: real));
begin
for var i := 0 to a.Length-1 do
p(a[i]);
end;
procedure mult2(var r: real);
begin
r := 2*r
end;
procedure print(var r: real);
begin
write(r,' ');
end;
var a: array of real := (1,2,3,6,7);
begin
writeln('Содержимое массива: ');
for_each(a,print);
writeln;
for_each(a,mult2);
writeln('Содержимое массива после умножения его элеметов на 2: ');
for_each(a,print);
end.