Sorting arrays

I need to make program that will load 10 English words using array, sort that array, clear screen and write the words sotred. I made the program but it is too slow when you work with larger arrays. Is there any way to make it faster?

[code]program sort;
uses crt;
var temp,min,i:integer;
a:array [0..10] of string;
begin
clrscr;
for i:=1 to 10 do readln(a[i]);
//SORT: Begin
temp:=1;
repeat
temp:=temp+1;
for i:=temp to 10 do begin
min:=i-1;
if a[i]<a[min] then begin
a[0]:=a[i];
a[i]:=a[min];
a[min]:=a[0]
end; {if}
end; {for}
until temp=10;
//SORT: End
clrscr;
for i:=1 to 10 do writeln(a[i]);
readln;
end.[/code]

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories