# how do i display a roman numerals from ordinary numbers??

Show 80 post(s) from this thread on one page
Page 2 of 3 First 123 Last
• 07-05-2011
AndrewHunter
So do you want to do this in C (which is the code you posted) or C++?
• 07-05-2011
Carr Paulo
yes!! c++..sorry for some wrong doing i am doing that only says to you that i am only a beginner in terms of this area..or forum..
• 07-05-2011
whiteflags
Quote:

Ordinary Numbers = Roman Numerals
1=I
5=V
10=X
50=L
100=C
500=D
100=M
I never understood the massive confusion that surrounds Roman numerals and using them. Proper Roman numerals are always arranged from greatest to least so conversion is simply done by computing from left to right. If a number or group of numbers is smaller than its neighbor then you have to subtract the left thing from the right thing in the sum. There is no standardization. XXCIII is as correct as LXXXIII is for 83, so sanitizing is kind of pointless.
• 07-05-2011
Matticus
Quote:

Ordinary Numbers = Roman Numerals
1=I
5=V
10=X
50=L
100=C
500=D
1000=M
• 07-05-2011
AndrewHunter
Quote:

Originally Posted by Carr Paulo
yes!! c++..sorry for some wrong doing i am doing that only says to you that i am only a beginner in terms of this area..or forum..

Does this look like something you know?
Code:

``` #include <iostream> using namespace std; int main(){   cout << "Hello world";   return (0); }```
• 07-05-2011
Carr Paulo
yeahh.it is easy in terms of coverting it..ahmmm plase mr.kindly my actual problem on the very beginning of the first page...thank you hope you understand what i want to say..thank you/
• 07-05-2011
Matticus
Quote:

Step 1: Is the input greater than the largest Roman numeral?

If not, then the very first numeral is not 'M'. If so, then the very first numeral is 'M'.
• 07-05-2011
Carr Paulo
mr.andrew the code that you posted i am not familiar on that kind of code..like i said i am only familiar in a header files..stdio.h and conio.h.

and i ahm only using the (int)as a variable declaration..

i i am only familiar with a code ending in getch; and }..
• 07-05-2011
Carr Paulo
no! my input data must:

"Iput a number to be converted:"

and as i result i will output it in form of roman numeral.

my problem is to convert the number to a roman numeral..with a no.input of a 3000 capacity.
• 07-05-2011
Matticus
Yes!

Step 1: Is the input greater than the largest Roman numeral? <----- Input number to be converted!

If not, then the very first numeral is not 'M'. If so, then the very first numeral is 'M'. <----- Output in the form of a Roman numeral!
• 07-05-2011
whiteflags
If numbers in Roman numerals are arranged from greatest to least it stands to reason that writing Roman numerals is just about taking the biggest chunks you can out of numbers.

Find out which of the biggest denominations you can start with and write it. Usually this means you can concentrate on each place value at once.

1984 is more than 1000. Write the letter M. Convert 984 next.
984 is less than 1000 but more than 500 so write D. Convert 484 next.
484 is less than 500 but more than one hundred. If we stick to the plan, we can convert a single place value. 4 Cs make up 400. Convert 84.
80 is more than 50, so write L, then convert 34.
30 is XXX. Convert 4.
Now we come to single digits which you should probably just have saved for lookup. 4 is IV.

You might end up with loooong numbers, but this is why we use Arabic.
• 07-05-2011
Carr Paulo
i cant get your point mr.matticus..am for us to communicate well..refer to my example..

when i input: 1000
the output must be: M

if i input:3000
then the output is:MMM

if i input 1
the output must be I

and i input 9
the out put must be IX..

_when ever i input..it mus output it equivalent roman numerals..my point is what formula i will do..when it comes in 9,111,11,3,4,1002,etc,,....

if only the numbers to be input is on the chart. it is easy..because i will only write the formula

example//
if(n(variable declaration as input value)==1)
prinf(The roman is: I);
else if(n==1000)
printf("The Roman is:M");

but how if the input is 9??
how i output it as IX??what formula i will do to ouput it??
do i need to ennumerate it all from 1 to 3000??
• 07-05-2011
King Mir
Well the usual standard is to have no more than than 3 consecutive digits added, so that XXX is 30, XL is 40, LXXX is 80, and XC is 90. But that just adds a few extra steps.

It's up to the OP and his instructor whether or not to apply that standard.

Converting the other way it would make sense to allow more liberal ordering.
• 07-05-2011
Matticus