Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


roman numeral converter

Posted on 1997-07-11
Medium Priority
Last Modified: 2012-05-04
I need a small c++ program to convert roman numerals to decimal. Any takers? Must provide souce...
Question by:datamike
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

ocurance earned 300 total points
ID: 1164783
Pass in the char array as a roman numeral, and Roman2Decimal will return the value that you're looking for.

int Roman2Decimal(const char *Roman)
   int Total = 0;

   for(int i = 0; i < strlen(Roman); i++)
            if(GetValue(Roman[i]) < GetValue(Roman[i + 1]))
                Total -= GetValue(Roman[i]);
                Total += GetValue(Roman[i]);


    return Total;


int GetValue(char numeral)
   int value = 0;

      case 'I':
        value = 1;

      case 'V':
        value = 5;

      case 'X':
         value = 10;

   return value;

Good Luck,

Expert Comment

ID: 1164784
Did this answer your question sufficiently?  Are you going to grade this now?

Author Comment

ID: 1164785
could you provide an entire c++ program? could you also do it without using pointers? if you can do these tasks, I'll give you an 'a' and an extra 100 points for 250 total.

Expert Comment

ID: 1164786
Give me your email address and I'll send you the whole program code.

Author Comment

ID: 1164787
send to: datamike@interaccess.com

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question