29 lines
708 B
Text
29 lines
708 B
Text
import extensions;
|
|
import system'math;
|
|
import system'routines;
|
|
|
|
extension op
|
|
{
|
|
ordinalize()
|
|
{
|
|
int i := self.Absolute;
|
|
if (new int[]{11,12,13}.ifExists(i.mod(100)))
|
|
{
|
|
^ i.toPrintable() + "th"
|
|
};
|
|
|
|
(i.mod(10)) =>
|
|
1 : { ^ i.toPrintable() + "st" }
|
|
2 : { ^ i.toPrintable() + "nd" }
|
|
3 : { ^ i.toPrintable() + "rd" };
|
|
|
|
^ i.toPrintable() + "th"
|
|
}
|
|
}
|
|
|
|
public Program()
|
|
{
|
|
Console.printLine(new Range(0,26).selectBy(mssgconst ordinalize<op>[1]));
|
|
Console.printLine(new Range(250,26).selectBy(mssgconst ordinalize<op>[1]));
|
|
Console.printLine(new Range(1000,26).selectBy(mssgconst ordinalize<op>[1]))
|
|
}
|