# Easy Roman Numeral Conversion

The following letters are the only upper case letters with their values:

Letter Value

A. I 1

B. V 5

C. X 10

D. L 50

E. C 100

F. D 500

G. M 1000

Note: the Subtraction Principle is used when the value of the first of two consecutive different Roman Letters is less than the second.

Rule #1: the only time the subtraction principle applies is with the Roman letters I, X, or C. The only letters that can immediately follow I, X, or C with value greater than I, X, or C are the next two letters of higher value. Example: IV is 4, IX is 9, but IL is illegal.

Rule #2: all Roman letters must be in lower case or all Roman letters must be in upper case.

Rule #3: Any sequence of three Roman letters cannot be nondecreasing except if the letters are all the same.

Rule #4: V, L, or D appears at most once.

M, C, or X appears at most four times.

I appears at most three times

Rule #5: M must appear first or second with a C preceding the M.

if M appears second with C preceding M then both M and D cannot appear again in the string.

if M starts the string then there can be at most three M's in a row followed by either CM, or CD, or D or a string of C's.

The rules for what may follow C, X, are similar.

## Deliverables

1) Complete and fully-functional working program in executable form as well as complete source code of all work done.

Extra notes: (not included in 'Description')

Input to the program should be either a string of characters representing a Roman Numeral or an Arabic Number and in either case spaces are not allowed.

Error-check the input code whether the input is correct or not. (You may either delete the spaces or copy the input string to another string without spaces.)

The program should either:

1)Convert a string of digits (Max. value, say 3999) to a Roman Numeral using the least amount of letters to represent the Arabic number, or

2) Convert a string of Roman Numerals to an Arabic number in an efficient way.

* please document well; each function should be described as to what the function does and what it returns. each of the function's parameters and local variables should be described as to how the parameters and local variables are modified, and how the parameters are used.

** Functions should be written w/only a few lines of code; they should be tested out completely.

## Platform

windows (2000, NT, XP, 98)

use MS Visual C++

( 3 comentários ) United States

ID do Projeto: #2987022

## Premiar a:

klickers

See private message.

\$7 USD em 3 dias
(122 Avaliações)
6.7

## 3 freelancers estão ofertando em média \$6 para este trabalho

ndima

See private message.

\$7.65 USD in 3 dias
(96 Comentários)
6.6
testcodervw

See private message.

\$3.4 USD in 3 dias
(0 Comentários)
0.0