В процедуре №1 создать файл целого типа INT1 из n элементов (n≥10). В процедуре № 2 создать новый файл INT2, в который

включить только первые 5 элементов из файла INT1.
pascal
  • Подскажите, насколько срочно нужно решение? !
    отметить нарушение!
    makarka

Ответы и объяснения

  • makarka
  • Отличник
  • 2017-07-31 14:18:01
program procedures_program;

var file1, file2: file of integer;

procedure proc1();
var i: integer;
begin
AssignFile(file1, 'int1');
rewrite(file1);
for i:=1 to 15 do
begin
write(file1, random(1000));
end;
CloseFile(file1);
end;

procedure proc2();
var x, i: integer;
begin
AssignFile(file1, 'int1');
AssignFile(file2, 'int2');
reset(file1);
rewrite(file2);
for i:=1 to 5 do
begin
read(file1, x);
write(file2, x);
writeln(x);
end;
CloseFile(file2);
CloseFile(file1);
end;

begin
proc1();
proc2();
readln;
end.
Задай вопрос
+