www.webdeveloper.com
Results 1 to 2 of 2

Thread: Algorithms Roman Numeral Conversion

  1. #1
    Join Date
    Jul 2005
    Posts
    1

    Lightbulb 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

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,151
    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

    eBookworm.us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles