Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- Mas: array [0 .. 3] of Real;
- Min, El: Real;
- Ind, I, J: Integer;
- t: Text;
- begin
- assign(t, 'out.pas');
- rewrite(t);
- Writeln('Введите элементы массива');
- for I := 0 to High(Mas) do
- begin
- Write('Mas[', I, '] = ');
- Readln(Mas[I]);
- end;
- Writeln('Исходный массив: ');
- Writeln(t, 'Исходный массив: ');
- for I := 0 to High(Mas) do
- begin
- Write(Mas[I]:5:2);
- Write(t, Mas[I]:5:2);
- if I < high(Mas) then
- begin
- Write(', ');
- Write(t, ', ');
- end;
- end;
- Min := Mas[0];
- Ind := 0;
- El := 0;
- for I := 0 to High(Mas) do
- begin
- Min := Mas[I];
- Ind := I;
- for J := I to High(Mas) do
- if (Mas[J] < Min) then
- begin
- Min := Mas[J];
- Ind := J;
- end;
- El := Mas[I];
- Mas[I] := Min;
- Mas[Ind] := El;
- end;
- Writeln;
- Writeln(t);
- Writeln('Массив после сортировки:');
- Writeln(t, 'Массив после сортировки:');
- for I := 0 to High(Mas) do
- begin
- Write(Mas[I]:5:2);
- Write(t, Mas[I]:5:2);
- if I < high(Mas) then
- begin
- Write(', ');
- Write(t, ', ');
- end;
- end;
- Close(t);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement