Roman Numerals Conversion
Mark Schonewille
m.schonewille at economy-x-talk.com
Thu Mar 25 13:40:49 EDT 2010
Oops, too quick....
The second line of the script should be
put "1,5,10,50,100,500,1000" into myArabs
function romanToArab theNumber
put "i,v,x,l,c,d,m" into myRomans
put "1,5,10,50,100,500,1000" into myArabs
put item itemoffset(last char of theNumber,myRomans) of myArabs
into myNumber
repeat with x = (number of chars of theNumber - 1) down to 1
put item itemoffset(char x of theNumber,myRomans) of
myArabs into myTemp1
put item itemoffset(char x + 1 of theNumber,myRomans) of
myArabs into myTemp2
if myTemp1 < myTemp2 then
subtract myTemp1 from myNumber
else add myTemp1 to myNumber
end repeat
return myNumber
end romanToArab
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Economy-x-Talk is always looking for new software development
projects. Feel free to contact me for a quote.
More information about the use-livecode
mailing list