uses crt sorting const 10 var mas byte -------------------- ----------

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
uses crt,sorting;
const n=10;
var a:mas;
t:byte;
{------------------------------------------------------------}
Procedure initArray(var arr:mas);
var i:integer;
begin
for i:=1 to n do
arr[i].key:=random(20)-10;
end;
{------------------------------------------------------------}
Procedure printArray(arr:mas);
var i:integer;
begin
for i:=1 to n do
write(arr[i].key:2, ' ');
writeln;
end;
{------------------------------------------------------------}
begin
clrscr;
{randomize;}
initArray(a);
printArray(a);
write('Enter the type of sort: ');
readln(t);
case t of
1: straightInsertion(a);
2: straightSelection(a);
3: bubleSort(a);
4: shakerSort(a);
5: quickSort(a,1,n);
else writeln('wrong type');
end;
printArray(a);
readkey;
end.