Посмотрите вариант первой задачи. Я сделал без массива, но с двумя файлами. Имена файлов и пути поправьте, как Вам надо. И не удивляйтесь, если, открыв в текстовом редакторе созданные программой файлы, Вы вместо чисел увидите непонятный набор символов. Так и должно быть, это свойство типизированных файлов. В отличие от текстовых.
Код:
Program Variant_8;
var
i,i1,i2,x: integer;
f,f1:file of integer;
Begin
WriteLn('Laboratornaya rabota #8_1');
WriteLn('Variant #8');
WriteLn('IS-12-2');
WriteLn('Hamchuk Evgeniy');
WriteLn;
Assign(f,'D:\xxx');
Rewrite(f);
Writeln('Input of numbers, the end input - 0');
i:=0;
Repeat
write('Element N',i,': ');
readln(x);
if x<>0 then write(f,x);
Inc(i);
Until x=0;
Writeln;
Close(f);
Reset(f);
Repeat
read(f,x);
write(x:4);
Until EoF(f);
Writeln;
Writeln;
i:=-1;
i1:=-1;
i2:=-1;
Reset(f);
Repeat
Inc(i);
Read(f,x);
If x<0 then i1:=i;
Until (x<0) or EoF(f);
i:=-1;
Reset(f);
Repeat
Inc(i);
Read(f,x);
If x>0 then i2:=i;
Until EoF(f);
If i1=-1 then
Writeln('File contains no negative elements') else
If i2=-1 then
Writeln('File contains no positive elements') else
If Abs(i2-i1)=1 then
Writeln('There are no elements between first negatine and last positive') else
begin
if i1>i2 then
begin
x:=i1;
i1:=i2;
i2:=x;
end;
Reset(f);
Assign(f1,'D:\yyy');
Rewrite(f1);
i:=-1;
repeat
inc(i);
read(f,x);
if (i>i1) and (i<i2) then write(f1,x);
until EoF(f);
Close(f);
Close(f1);
Reset(f1);
repeat
read(f1,x);
write(x:4);
until EoF(f1);
Close(f1);
end;
Readln
End.