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

Comments

  • Actor21Actor21 Posts: 35Member
    [code]
    type
    stringarray = array[1 .. 8] of string ;

    function alphabetise (a : stringarray) : 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 : stringarray ;
    i : integer ;
    begin
    for i := 1 to 8 do
    readln (b[i]) ;
    writeln ;
    writeln (alphabetise(b)) ;
    readln
    end.

    [/code]
Sign In or Register to comment.