Help with pascal function - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Help with pascal function

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 :)

[color=Red]function alphabetise[/color](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.