Question
Arabic to Roman Numerals!!! C++ Programming Help Please! Program Info: Write a program that accepts a year written as a four-digit Arabic (ordinary) numeral and
Arabic to Roman Numerals!!! C++ Programming Help Please!
Program Info: Write a program that accepts a year written as a four-digit Arabic (ordinary) 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 V 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 the 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.
More Important Info:
Enter an Arabic number: 2456
2456 is MMCDLVI in Roman numerals
Play again? Y
Enter an Arabic number: 1359
1359 is MCCCLIX in Roman numerals
Play again? N
Read the number as an integer: e.g. 9786
Use arithmetics to separate each digit into separate ints: (do you know what the modulus operator is? % No? look it up.)
ones will be 6
tens will be 8
hundreds will be 7
thousands will be 9
***use FOUR SWITCH CASES to output the correct string for each digit:
1. cout<
2. cout<
3. etc.
***As with all the projects in this chapter, wrap this whole thing in a Play another game loop to allow the user to play as many times as they like.
REMEMBER use 4 SWITCH CASES FOR OUTPUT! (In other words use SWITCH STATEMENTS for displaying the output).
THANK YOU! :)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started