Write a program that accepts a year written as a four-digit Arabic numeral and o
ID: 3622898 • Letter: W
Question
Write a program that accepts a year written as a four-digit Arabic numeral and outputs the year written in Roman numerals. Important Roman numerals are V for 5, X for 10, L for 50, C for 100, D for 500, and M for 1,000. Recall that some numbers are formed by using a kind of subtraction of one Roman “digit”; for example, IV is 4 produced as C minus I, XL is 40, CM is 900, and so on. A few sample years: MCM is 1900, MCML is 1950, MCMLX is 1960, MCMXL is 1940, MCMLXXXIX is 1989. Assume year is between 1000 and 3000. Your program should include a loop that lets the user repeat this calculation until the user says she or he is done.
Use a sentinal control loop to repeat the calculations . Use -1 as the sentinal value.
Use several switch statements to print the Roman numerals.
Explanation / Answer
an easy way to do this would do a series of loops, subtracting the from the number when you output a digit while (number >= 1000){ cout = 900){ cout = 500) { cout = 400) { cout = 100) coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.