This might give you some ideas. It isn't complete by any means, but is a general approach.
Code:
char numerals[80];
int numeralCount,i;
int firstValue,secondValue;
scanf("%s",numerals);
printf("You entered: %s\n",numerals);
numeralCount = strlen(numerals);
for (i = 0; i < numeralCount; i++) {
printf("%c\n",numerals[i]);
if (i != (numeralCount - 1)) { // not on last character
firstValue = getValue(numerals[i]); // return 1000 for 'M', etc....
secondValue = getValue(numerals[i+1]);
if (firstValue < secondValue) {
// do your 'less than' magic
i++; // 'consume' the second char, since you want to step over it next time
}
else {
// just add the value
}
}
else { // on last character
// to get here, must need to add final char value
}
}
note that when you have a 'less than' case, like IV, you want the next time thru the loop to skip to the character after the V. That's what the i++ 'consume' is for.
You'd have a 'finalValue' variable or some such that got added to each time thru the loop, and at the end would be your final result.
-------
Beginner Computer Programming
teaching programming to beginners using C