! Ordinal       An Inform 5.5 library extention by L. Ross Raszewski
!               Prints an ordinal number (First, Second, etc.)
!Have your code call "OrdinalNum(#)" to print out # as an ordinal number
!Much thanks to Graham Nelson, for EnglishNum(), on which this is based
!INCLUDE it after Grammar, but before anything that uses it.

[ OrdinalNum n f;
        if (n==0) "zeroth";
        if (n>=100) { EnglishNumber(n-(n%100)); f=1;}
        n=n%100; if (f==1 && n~=0) print " "; f=0;
        if (n>20 && (n%10)~=0) { EnglishNumber(n-(n%10)); n=n%10; f=1;}
        if (f==1) print "-";
        if (n==0) print "th";
        if (n==90) print "nintieth";
        if (n==80) print "eightieth";
        if (n==70) print "seventieth";
        if (n==60) print "sixtieth";
        if (n==50) print "fiftieth";
        if (n==40) print "fortieth";
        if (n==30) print "thirtieth";
        if (n==20) print "twentieth";
        if (n==19) print "ninteenth";
        if (n==18) print "eighteenth";
        if (n==17) print "seventeenth";
        if (n==16) print "sixteenth";
        if (n==15) print "fifteenth";
        if (n==14) print "fourteenth";
        if (n==13) print "thirteenth";
        if (n==12) print "twelfth";
        if (n==11) print "eleventh";
        if (n==10) print "tenth";
        if (n==9) print "ninth";
        if (n==8) print "eigth";
        if (n==7) print "seventh";
        if (n==6) print "sixth";
        if (n==5) print "fifth";
        if (n==4) print "fourth";
        if (n==3) print "third";
        if (n==2) print "second";
        if (n==1) print "first";
];

