In C Code Roman Numerals are always written from larger values to smaller values, for example: M = 1000 MM = XXXXXXXXXX = 2000 MDX = XXXXXXXXXX = 1510 III = XXXXXXXXXX = 3 the decimal equivalent is...

In C Code Roman Numerals are always written from larger values to smaller values, for example: M = 1000 MM = 1000 + 1000 = 2000 MDX = 1000 + 500 + 10 = 1510 III = 1 + 1 + 1 = 3 the decimal equivalent is computed by adding up the decimal value of the Roman Numerals. There is one exception to this rule: if the numeral is smaller than the next value, that value is subtracted. For example: MCM = 1000 + (-100) + 1000 = 1900 (since C is smaller than M) LIX = 50 + (-1) + 10 = 59 (since I is smaller than X) You program must prompt the user for a Roman Numeral as a string, convert the numerals to their respective decimal value, then compute the resulting decimal value. You should test your program with the following inputs: MCXIV = 1114 CCCLIX = 359 MXVI = 1016 MDCLXVI = 1666 Your program must loop accepting Roman Numerals (up to 20 characters long), converting them to their decimal equivalent, and printing the results until the user enters EXIT (which is not a valid Roman numeral and should not be converted). Your program must validate that only legal Roman Numerals have been entered (i.e., only the uppercase characters listed above are valid roman numerals) and that the Roman numeral is not too long. Your program must contain A type def with struct called Roman numeral that holds the The Roman numeral as a string The decimal value of the roman number as an integer Implementations of the function prototypes shown below NOTE: you should not need to change the main function in the starter code to complete this lab.
May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here