Имеется текстовый файл. Напечатать его строки с S-й по P-ю — Pascal(Паскаль)

var
doc:text;
count,p,s,i,kol:integer;
temp:string;
begin
assign(doc,'doc.txt');
reset(doc);
while not eof(doc) do
  begin
  readln(doc);
  inc(count);
  end;
readln(s);
readln(p);
reset(doc);
kol:=p-s+1;
i:=0;
if (s<count) and (p<=count) then
  while i<>kol do
    begin
    if (i+1 >= s)and (i+1<=p) then
        begin
        readln(doc,temp);
        writeln(temp);
        end
    else readln(doc);
    inc(i);
    end;
close(doc);
end.

Leave a Comment

+ 47 = 55