Question: What's wrong with this code? onvert between Arabic, base ten numbers, and Roman numerals. The Roman number system has the digits I, V, X, L,

onvert between Arabic, base ten numbers, and Roman numerals. The Roman number

What's wrong with this code?

system has the digits I, V, X, L, C, D, and M.

Numbers are formed according to the following rules: 1. Only numbers up

onvert between Arabic, base ten numbers, and Roman numerals. The Roman number system has the digits I, V, X, L, C, D, and M. Numbers are formed according to the following rules: 1. Only numbers up to 3,999 are represented. 2. As in the decimal system, the thousands, hundreds, tens, and ones are expressed separately. (In other words, it's a positional number system.) The numbers 1 to 9 are expressed like the table shown at the right. As you can see, a I preceding a V or X is subtracted from the value, and you can never have more than three I's in a row. Tens and hundreds are done the same way, except that the let- ters X, L, C, and C, D, M are used instead of I, V, X respectively. I II III IV V VI VII VIII IX 1 2 3 4 5 6 7 8 9 The toRoman() function accepts a decimal number such as 1978, and converts it to a string containing the Roman numerals "MCMLXXVIII". An invalid number (0, a negative number, or a number greater than 3,999) returns the string "OUT OF RANGE". string digit(int n, const string symbols); string ones (int n) { return digit(n, "IVX"); } string tens(int n) { return digit(n, "XLC"); } string hundreds(int n) { return digit(n, "CDM"); } Do make things easier for you, I've already written a regular console program that converts integers to Roman numerals. You'll find it in the file decToRoman.txt. Notice that the program is long and complex. Decompose toRoman () using the following four functions, which will be tested separately as well. C

Step by Step Solution

3.52 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To convert between Arabic base ten numbers and Roman numerals you can use the provided functions digit ones tens and hundreds These functions will hel... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!