C++ Programming Acceleration Delight! I enjoy asked this corresponding investigation numerous times on Chegg… never got a amiable rejoinder
NOTE: READ ENTIRE PROGRAM DESCRIPTION CAREFULLY! Thank You!
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 coercion 5, X coercion 10, L coercion 50, C coercion 100, D coercion 500, and M coercion 1,000. Recundiminished that some aggregate are coercionmed by using a husk of separation of undivided Roman “digit”; coercion stance, IV is 4 manufactured as V minus I, XL is 40, CM is 900, and so on. A lacking instance years: MCM is 1900, MCML is 1950, MCMLX is 1960, MCMXL is 1940, MCMLXXXIX is 1989. Assume the year is among 1000 and 3000. Your program should enclose a loop that lets the representationr iterate this anticipation until the representationr says she or he is manufactured.
More Important Info/OUTPUT:
Enter an Arabic estimate: 2456
2456 is MMCDLVI in Roman numerals
Dramatize frequently? Y
Enter an Arabic estimate: 1359
1359 is MCCCLIX in Roman numerals
Dramatize frequently? N
Read the estimate as an integer: e.g. 9786
Representation arithmetics to disunited each digit into disunited ints: (do you perceive what the modulus operator is? “%” No? behold it up.)
USE THE MODULUS OPERATOR -> %
ones conciliate be 6
tens conciliate be 8
hundreds conciliate be 7
thousands conciliate be 9
***representation FOUR SWITCH CASES to output the improve string coercion each digit:
cout<<”XX” in instance of tens nature 2
cout<<”XXX” in instance of tens nature 3
etc.
***As with undiminished the projects in this provision, infold this undiminished invention in a “Dramatize another game” loop to undiminishedow the representationr to dramatize as numerous times as they enjoy.
MAKE SURE TO USE FOUR SWITCH CASES FOR OUTPUT!!!
Delight Note: Keep the program single… representation single commands DO NOT representation .append
^^^ READ PROGRAM DESCRIPTION CAREFULLY PLEASE ^^^
(I enjoy asked this investigation distinct times on Chegg… and never got a befitting rejoinder.. delight acceleration me…)
#include<iostream>
using namespace std;
int deep()
{
int n;
char ch = ‘ ‘;
do{
cout << “nEnter an Arabic estimate: “;
while(cin>>n)
{
int x,y,k,l;
l=(n/1000)*1000;
if(l==1000)
cout<<“M”;
if(l==2000)
cout<<“MM”;
if(l==3000)
cout<<“MMM”;
if(l==4000)
cout<<“-IV”;
if(l==5000)
cout<<“-V”;
if(l==6000)
cout<<“-VI”;
if(l==7000)
cout<<“-VII”;
if(l==8000)
cout<<“-VIII”;
if(l==9000)
cout<<“-IX”;
if(l==10000)
cout<<“-X”;
k=(n%1000);
k=(k/100)*100;
if (k == 100)
cout<<“C”;
else if (k == 200)
cout<<“CC”;
else if (k == 300)
cout<<“CCC”;
else if (k == 400)
cout<<“CD”;
else if (k ==500)
cout<<“D”;
else if (k == 600)
cout<<“DC”;
else if (k == 700)
cout<<“DCC”;
else if (k ==800)
cout<<“DCCC”;
else if (k == 900)
cout<<“CM”;
k=n%1000;
l=k%100;
y=(l/10)*10;
if (y == 10)
cout<<“X”;
else if (y == 20)
cout<<“XX”;
else if (y == 30)
cout<<“XXX”;
else if (y == 40)
cout<<“XL”;
else if (y ==50)
cout<<“L”;
else if (y == 60)
cout<<“LX”;
else if (y == 70)
cout<<“LXX”;
else if (y ==80)
cout<<“LXXX”;
else if (y == 90)
cout<<“XC”;
x=l%10;
if (x == 1)
cout<<“I”;
else if (x == 2)
cout<<“II”;
else if (x == 3)
cout<<“III”;
else if (x == 4)
cout<<“IV”;
else if (x ==5)
cout<<“V”;
else if (x == 6)
cout<<“VI”;
else if (x == 7)
cout<<“VII”;
else if (x ==8)
cout<<“VIII”;
else if (x == 9)
cout<<“IX”;
cout<<” in Roman numerals”;
cout<<endl;
cout <<“nDramatize frequently?(Y/N): “;
cin >> ch;
ch = toupper(ch);
}
}while(ch==’Y’);
return 0;
}