Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a C++ problem. Please give full explanation and code in details. Thanks. The ancient Roman numbering system employed a sequence of letters to

image text in transcribed

image text in transcribed

This is a C++ problem. Please give full explanation and code in details. Thanks.

The ancient Roman numbering system employed a sequence of letters to represent numeric values. Values were obtained by summing individual letter values in a left-to-right fashion. The value of individual Roman numerals is provided in the following list: X- 10 L = 50 C- 100 D-500 M 1000 In Roman numbers, larger numeral values generally appear before smaller values, and no single numeral may be repeated more than 3 times in a row. There are a few numbers that cannot be represented with these restrictions, so an additional rule was provided to deal with these cases: if a higher value numeral is preceded by a single smaller numeral, the smaller value is subtracted from the larger one. This rule is only applied to a small number of cases: IV (4), IX (9), XL (40), XC (90), CD (400) and CM (900). Using these simple rules, we can construct a method to convert an integer (decimal) value to a Roman number as follows: Step 1: If the value of the number is in [900,999] output "CM" If the value is in [500,899] output "D" If the value is in [400,499] output "CD" If the value is in [100,399] output "C" If the value is in [90,99] output "XC" If the value is in [50,89] output "L" If the value is in [40,49] output "XL" If the value is in [10,39] output "X" If the value is 9, output "IX" If the value is in [5,8] output "V" If the value is 4, output "IV" If the value is in [1,3], output "T" Subtract the value of the 1 or 2 letter sequence that was just output from the integer number value, producing a 'remainder.' For example, if the original number was 93, the program would have printed "XC" in Step 1, and then, in this step, subtracted 90 to get a remainder of 3, and then continued with 3 as the number. Step 3: Repeat the process until the remainder value is zero. Using this method, write a program that does the following .Reads in an integer value from 1 to 999, inclusive. . Checks to make sure the input value is >0 and

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions