roman numeral converter

Posted on 1997-07-11
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 150 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:

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

624 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