I'm working on a converting Roman numbers to Decimal problem. My lackluster code will output a single roman character as decimal form, but that gets me very little. My idea was that I could store a multi-charactered roman number, and possibly iterate the characters through the switch statement, then use the modulo operator in another switch or if/else succession to print the number. I don't feel like I'm gaining any traction with the problem and could use some advice to get me going in the right direction.
you can try getting the char one by one(from the string):
////NOTE! romNum is changed to string!! because they are more manageable :)
////decimal is initiated as int decimal = 0
for(unsigned int i = 0;i<romNum.size;i++)
switch(romNum.c_str()[i])
case 'M': decimal += 1000; break; ///so on....
and as a side note....there are IV, IX, so on, and XV, so you have to deal with algorithms for those too. But I guess it will become more easy by now. Good luck for that. :)