Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const//размеры первого и второго массива
- n = 5;
- m = 6;
- var
- f, f1,f3: text;
- a: array[1..n] of integer;
- b: array[1..m] of integer;
- c: array[1..n + m] of integer; //полученный массив
- sum, buf, j, i, x: integer;
- begin
- assign(f, 'input.txt'); //вводим файл
- reset(f); //читаем
- while not eof(f) do //пока не конец файла
- begin
- inc(i);
- read(f, a[i]); //вводим в массив значения из файла
- end;
- assign(f1, 'input1.txt'); //вводи второй массив аналогично
- reset(f1);
- while not eof(f1) do
- begin
- inc(j);
- read(f1, b[j]);
- end;
- for x := 1 to n do
- begin
- c[x] := a[x]; //заполняем массив с первым массивом
- end;
- sum := n + m;//размер массива с
- i := 1;
- for x := n+1 to sum do //заполняем с середины массива, т.к 1 часть заполнена уже
- if i <= m then
- begin
- c[x] := b[i]; //заполняем массив с вторым массивом
- inc(i);
- end;
- for x := 1 to sum do
- writeln(c[x]);
- for i:= 1 to sum-1 do
- for j:=i+1 to sum do
- if c[i] > c[j] then
- begin
- buf:=c[i];
- c[i]:=c[j];
- c[j]:=buf;
- end;
- assign(output, 'output.txt');
- rewrite(output);
- writeln('Полученный массив: ');
- for x := 1 to sum do
- write(c[x]:3);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement