Помогите пожалуйста с паскалем кто знает сортировку

const
m = 100000;
var
arr: array[1..256] of longint;
k,s,j,i: longint;

begin

randomize;

for i := 1 to m do
begin
k := random(256);
k:= k+1;
arr[k] := arr[k]+1;
end;

for i:= 1 to 256 do
begin
writeln ('массив ',i,' - ',arr[i]:4)
end;

for i := 1 to 256 do
for j := 1 to m-i do
if arr[j] > arr[j+1] then {тут ошибка}
begin
s := arr[j];
arr[j] := arr[j+1];
arr[j+1] := s
end;
write ('Отсортированный массив: ');
for i := 1 to 256 do
write (arr[i]:4);
end.
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.