-
Roman Numerals
Here is my problem:
Input: Roman Numerals (M=1000, D=500, C=100, L=50, X=10, V=5, I=1)
Ouput: Roman Numerals converted.
The program asks the user to enter two roman numbers to be added.
How do I convert these numerals into reg. numbers?
How do I convert a reg. number into a roman numeral?
Thank for the HELP.
-
Re: Roman Numerals
"Adrian" <noemail@aol.com> wrote:
>
>Here is my problem:
>
>Input: Roman Numerals (M=1000, D=500, C=100, L=50, X=10, V=5, I=1)
>Ouput: Roman Numerals converted.
>The program asks the user to enter two roman numbers to be added.
>How do I convert these numerals into reg. numbers?
>How do I convert a reg. number into a roman numeral?
>
>Thank for the HELP.
>
>
The easiest way is to to read the numbers as a char and compare it to values
with switch() case. But the numbers can't added simply by checking its values
because I and X is as reg. number 9. So you have the compare both numbers
and if the first one is lower than the second subtract the first from the
second. The comparison could be made in a function you call when you need
it.
Hope this helps
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks