Код
Const
n = 8;
Type
TType = Integer;
arrType = Array[1 .. n] Of TType;
Const
a: arrType =
(57, 55, 0, 0, 94, 18, 6, 67);
var i:integer;
Procedure Insert(Var source, sorted: arrType);
Var
i, j,l: Integer;
x: TType;
label bash;
Begin
move(source, sorted, SizeOf(arrType));
l:=1;
bash: For i := l To n do
Begin
x := sorted[i];
j := Pred(i);
if x=0 then begin l:=l+1;goto bash;end;
While x < sorted[j] Do
Begin
sorted[Succ(j)] := sorted[j]; Dec(j);
End;
sorted[Succ(j)] := x;
End;
for i:=1 to n do writeln(sorted[i]);
End;
Var
b: arrType;
Begin
Insert(a, b);
End.
На большее меня не хватает)) а искуственные выходы из циклов не люблю. А по другому не знаю как. Так то вроде работает.