Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,32 @@
|
|||
bundle Default {
|
||||
class Roman {
|
||||
nums: static : Int[];
|
||||
rum : static : String[];
|
||||
|
||||
function : Init() ~ Nil {
|
||||
nums := [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
|
||||
rum := ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"];
|
||||
}
|
||||
|
||||
function : native : ToRoman(number : Int) ~ String {
|
||||
result := "";
|
||||
|
||||
for(i :=0; i < nums->Size(); i += 1;) {
|
||||
while(number >= nums[i]) {
|
||||
result->Append(rum[i]);
|
||||
number -= nums[i];
|
||||
};
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
Init();
|
||||
|
||||
ToRoman(1999)->PrintLine();
|
||||
ToRoman(25)->PrintLine();
|
||||
ToRoman(944)->PrintLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue