Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Nth/Objeck/nth.objeck
Normal file
35
Task/Nth/Objeck/nth.objeck
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
class Nth {
|
||||
function : OrdinalAbbrev(n : Int ) ~ String {
|
||||
ans := "th"; # most of the time it should be "th"
|
||||
if(n % 100 / 10 = 1) {
|
||||
return ans; # teens are all "th"
|
||||
};
|
||||
|
||||
select(n % 10){
|
||||
label 1: { ans := "st"; }
|
||||
label 2: { ans := "nd"; }
|
||||
label 3: { ans := "rd"; }
|
||||
};
|
||||
|
||||
return ans;
|
||||
}
|
||||
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
for(i := 0; i <= 25; i+=1;) {
|
||||
abbr := OrdinalAbbrev(i);
|
||||
"{$i}{$abbr} "->Print();
|
||||
};
|
||||
|
||||
""->PrintLine();
|
||||
for(i := 250; i <= 265; i+=1;) {
|
||||
abbr := OrdinalAbbrev(i);
|
||||
"{$i}{$abbr} "->Print();
|
||||
};
|
||||
|
||||
""->PrintLine();
|
||||
for(i := 1000; i <= 1025; i+=1;) {
|
||||
abbr := OrdinalAbbrev(i);
|
||||
"{$i}{$abbr} "->Print();
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue