Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to read in a string of characters that represent a Roman numeral

ID: 3544000 • Letter: W

Question

Write a program to read in a string of characters that represent a Roman

numeral and then convert it to Arabic form (an integer). The character values

for Roman numerals are as follows:

M 1000

D 500

C 100

L 50

X 10

V 5

I 1

Test your program on the following data :

LXXXVII (87), CCXIX (219), MCCCLIV (1354), MMDCLXXIII (2673), MCDLXXVI (1476)

LXXXVII

50 + 10 +10+10+5+1+1

CCXIX

100 +100 +10 +1 +10 -1 -1

M 1000

D 500

C 100

L 50

X 10

V 5

I 1

MCCCLIV

1000 + 100 + 100 + 100 + 50 + 1 +5 - 1 -1

MMDCLXXIII

1000 + 1000 + 500 + 100 + 50 + 10 + 10 +1 + 1 +1

MCDLXXVI

1000+100+500-100-100+50+10 + 10+5+1

You must use at least one function.

LXXXVII

CCXIX

MCCCLIV

MMDCLXXIII Cpsc1103 week 6 notes page 2 of 3

MCDLXXVI

?save file when cursor is on the next line


pseudo codes:

start

allocate variables

initialize files

while not end of file

read ch ins.get(ch);

sum = 0;

while (ch !=

Explanation / Answer

#include<>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote