Jan 18, 2012 at 2:16am UTC
Hi I am new to C++
I am trying to write Roman Numeral converter from roman to arabic.
I am getting error on this loop.
please help me
IV - 4
IX - 9
XL - 40
XC - 90
CD - 400
CM - 900
when I input IV It gives me answer 4.
when I input IX It gives me error. It should give me answer 9.
thanks :)
Last edited on Jan 18, 2012 at 11:03pm UTC
Jan 18, 2012 at 4:29am UTC
Could you show the complete program? That may help.
Jan 18, 2012 at 5:05am UTC
@abbeyp03, what did you post the hyper link for?
Jan 18, 2012 at 5:56am UTC
Uh, sorry abbeyp03, but this is not a JavaScript forum. And don't post completely unrelated links.
Jan 18, 2012 at 11:46am UTC
The for loop on line 36 goes one value too far. Try: for (int j = 0; j < length-1; j++)
on that line.
This is because of the indexing to j+1 in the body of that loop.
Last edited on Jan 18, 2012 at 11:48am UTC
Jan 18, 2012 at 11:02pm UTC
@fun2code, you are my hero thanks