Const
N = 13;
Type
Mass = array[1..N] of real;
Var
f:file of real;
A:Mass;
Max:integer;
Procedure CF(f:file of real);
Begin
Assign(f,'File.real');
Rewrite(f);
For var i:= 1 to N do
Write(f,N*(random-random))
End;
Procedure RF(f:file of real; Var A:Mass; Var Max:integer);
Var
i:integer;
Begin
Reset(f);
Write('Исходный массив:');
Max:=1;
For i:= 1 to N do
Begin
Read(f,A[i]);
Write(' ',A[i]:0:3);
if A[i] > A[Max] then Max:=i;
End;
WriteLn;
End;
Begin
CF(f);
RF(f,A,Max);
WriteLn('Max = A[',Max,'] = ',A[Max]:0:3);
End.
Пример работы программы:
Исходный массив: 8.731 1.629 1.482 9.547 3.067 -3.207 9.701 -2.065 -0.447 -0.980 -4.818 -0.603 -2.742
Max = A[7] = 9.701