Alphabetically smallest name - Programmers Heaven

Howdy, Stranger!

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

Categories

Alphabetically smallest name

programmer2772programmer2772 Posts: 4Member
Can somebody please look through this program and tell me why he isn't working properly. I want it to read eight names and write the alphabetically smallest one. Every helpfull advice is appriciated :)

function alphabetise(a:array of string):string;
var i,min:integer;
begin
min:=1;
for i:=1 to 8 do if a[i]<a[min] then min:=i;
alphabetise:=a[min];
end;

var b:array[1..8] of string; i:integer;
begin
for i:=1 to 8 do readln (b[i]);
writeln;
writeln (alphabetise(b));
readln
end.
Sign In or Register to comment.