PDA

View Full Version : Arabic to Roman



tresix9
October 16th, 2007, 11:25 PM
I have to write a program that takes as input arabic numbers and converts them into roman, between 1000 and 3000. I was thinking about using codes, but I honestly don't know where to begin. Can anyone help?? ***Using Pascal****

LaRoza
October 17th, 2007, 12:10 AM
I have to write a program that takes as input arabic numbers and converts them into roman, between 1000 and 3000. I was thinking about using codes, but I honestly don't know where to begin. Can anyone help?? ***Using Pascal****

Well, for a quick kludge, you can have an associative array with each equivalent.

It sounds like you are doing homework (Pascal, program you "need" help with, and are not willing to develop the algorithim yourself.

-EDIT use google, I just found a perfect example.

mjwood0
October 17th, 2007, 12:23 AM
Interesting... one post, and a homework type question.

Next up, how to compute the first 40 prime numbers and the Fibonacci of 20... Then, a binary search tree...

In the case you're legit, give us your ideas and your questions and perhaps we can help.

tresix9
October 17th, 2007, 12:44 AM
Well since it is mid Oct, and the semester is half over, I 'd say that I haven't had my first hw assignment, but way to be polite about it..nice.

I was trying to figure out how to use a case:

Rom={}
Rom["M"] = 1000
Rom["CM"] = 900
Rom["D"] = 500
Rom["CD"] = 400
Rom["C"] = 100
Rom["XC"] = 90
Rom["L"] = 50
Rom["XL"] = 40
Rom["X"] = 10
Rom["IX"] = 9
Rom["V"] = 5
Rom["IV"] = 4
Rom["I"] = 1

But I can't figure out, if someone were to enter in:
1967
MCMLXVII

I don't know how I would get the program to add case[I] twice for the V+II and so on....

just confused.