Algorithms Roman Numeral Conversion
Hi I start learning Development and my teacher ask me to write an algorithms for "Roman Numeral Conversion ".
Could you please help me
I'm against doing people's homework for them, but here are some hints:
You'll need a data table of some sort such as an associative array to relate each roman digit (i, v, x, etc.) to its decimal equivalent.
Walk through the roman numeral string character by character. If the character is not the last in the string, look at the next character, and if the next character is greater than the current character, subtract the current character's decimal value from the running total, otherwise add it to the total.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)