Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
window 1
|
||||
|
||||
local fn RomantoDecimal( roman as CFStringRef ) as long
|
||||
long i, n, preNum = 0, num = 0
|
||||
|
||||
for i = len(roman) - 1 to 0 step -1
|
||||
n = 0
|
||||
select ( fn StringCharacterAtIndex( roman, i ) )
|
||||
case _"M" : n = 1000
|
||||
case _"D" : n = 500
|
||||
case _"C" : n = 100
|
||||
case _"L" : n = 50
|
||||
case _"X" : n = 10
|
||||
case _"V" : n = 5
|
||||
case _"I" : n = 1
|
||||
end select
|
||||
if ( n < preNum ) then num = num - n else num = num + n
|
||||
preNum = n
|
||||
next
|
||||
|
||||
end fn = num
|
||||
|
||||
print @" MCMXC = "; fn RomantoDecimal( @"MCMXC" )
|
||||
print @" MMVIII = "; fn RomantoDecimal( @"MMVIII" )
|
||||
print @" MMXVI = "; fn RomantoDecimal( @"MMXVI" )
|
||||
print @"MDCLXVI = "; fn RomantoDecimal( @"MDCLXVI" )
|
||||
print @" MCMXIV = "; fn RomantoDecimal( @"MCMXIV" )
|
||||
print @" DXIII = "; fn RomantoDecimal( @"DXIII" )
|
||||
print @" M = "; fn RomantoDecimal( @"M" )
|
||||
print @" DXIII = "; fn RomantoDecimal( @"DXIII" )
|
||||
print @" XXXIII = "; fn RomantoDecimal( @"XXXIII" )
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue