Exercise 9: Structured Roman Numbers

This exercises introduces you to C strings (that is, null-terminated strings) and C struct values by doing. This mirrors what you will see in industry: someone will tell you to learn a new programming construct or library by saying “go solve this problem”. The difference is that here you can work with other students on your solution, though everyone has to submit their own answer.

You are being given a skeleton of a C program, MSOE roman.c, which is to read a list of simplified Roman numbers, convert any “IIII” to “IV” and any “VIIII” to “IX”, echo back the input, and write the sum of the values as a decimal. A sample run follows:

Enter roman numbers:

XI

XVIIII

IIII

XXIIII

Rewritten numbers:

XI

XIX

IV

XXIV

Sum: 58

where the first set of roman numbers (before “Rewritten”) were entered by the user. You can assume the only digits are X, V, and I. You can also assume that all Xs are before Vs and all Vs before Is. There will be up to 20 roman numbers in the input. The program has additional constraints that are given in the code. Submit your solution to esubmit as exroman. It will be graded just for correctness, but note that correctness includes meeting the requirements in the code.