Advertisement
deced

Untitled

Dec 23rd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. var
  2. Mas: array [0 .. 3] of Real;
  3. Min, El: Real;
  4. Ind, I, J: Integer;
  5. t: Text;
  6.  
  7. begin
  8. assign(t, 'out.pas');
  9. rewrite(t);
  10. Writeln('Введите элементы массива');
  11. for I := 0 to High(Mas) do
  12. begin
  13. Write('Mas[', I, '] = ');
  14. Readln(Mas[I]);
  15. end;
  16. Writeln('Исходный массив: ');
  17. Writeln(t, 'Исходный массив: ');
  18. for I := 0 to High(Mas) do
  19. begin
  20. Write(Mas[I]:5:2);
  21. Write(t, Mas[I]:5:2);
  22. if I < high(Mas) then
  23. begin
  24. Write(', ');
  25. Write(t, ', ');
  26. end;
  27. end;
  28. Min := Mas[0];
  29. Ind := 0;
  30. El := 0;
  31. for I := 0 to High(Mas) do
  32. begin
  33. Min := Mas[I];
  34. Ind := I;
  35. for J := I to High(Mas) do
  36. if (Mas[J] < Min) then
  37. begin
  38. Min := Mas[J];
  39. Ind := J;
  40.  
  41. end;
  42. El := Mas[I];
  43. Mas[I] := Min;
  44. Mas[Ind] := El;
  45. end;
  46. Writeln;
  47. Writeln(t);
  48. Writeln('Массив после сортировки:');
  49. Writeln(t, 'Массив после сортировки:');
  50. for I := 0 to High(Mas) do
  51. begin
  52. Write(Mas[I]:5:2);
  53. Write(t, Mas[I]:5:2);
  54. if I < high(Mas) then
  55. begin
  56. Write(', ');
  57. Write(t, ', ');
  58. end;
  59. end;
  60. Close(t);
  61. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement