#include<iostream>
#include<sstream>
#include<exception>
std::string decimal_to_roman (unsigned num) {
std::stringstream ss {};
while (num>0) {
if (num>10000)
throw std::range_error (
"ERROR: decimal_to_roman (unsigned num) [num is out of range]");
else if (num==10000) { ss<<"[M]"; num-=10000; }
else if (num>=9000) { ss<<"[CM]"; num-=9000; }
else if (num>=5000) { ss<<"[D]"; num-=5000; }
else if (num>=4000) { ss<<"[CD]"; num-=4000; }
else if (num>=1000) { ss<<"M"; num-=1000; }
else if (num>=900) { ss<<"CM"; num-=900; }
else if (num>=500) { ss<<"D"; num-=500; }
else if (num>=400) { ss<<"CD"; num-=400; }
else if (num>=100) { ss<<"C"; num-=100; }
else if (num>=90) { ss<<"XC"; num-=90; }
else if (num>=50) { ss<<"L"; num-=50; }
else if (num>=40) { ss<<"XL"; num-=40; }
else if (num>=10) { ss<<"X"; num-=10; }
else if (num==9) { ss<<"IX"; num-=9; }
else if (num>=5) { ss<<"V"; num-=5; }
else if (num==4) { ss<<"IV"; num-=4; }
else if (num>=1) { ss<<"I"; num-=1; }
}
return ss.str();
}
int main (void) {
for (unsigned n=1; n<=10000; ++n) {
try {
std::cout << n << "\t = " << decimal_to_roman(n) << std::endl;
}
catch (std::range_error& e) {
std::cerr<<e.what()<<std::endl;
break;
}
}
}
good morning
It would be a monumental task to type out all the numbers in Roman numerals. A better course of action is for you to type "Roman Numerals" into your web browser and you'll get many links to sites where they display them. You can even print them out for yourself.
This is a homework question and does not deserve an answer because you will learn nothing other than being lazy.
They existed for a while, but aren't in print anymore.
echo 'print a pattern'
write a program to print A to Z on screen in c?
Print Server
Use the option File / Print in the program you are using.
Select the answer, copy and paste into a word processing program, and print as you would print any other document.
If your screen does not give you an option to Print then save the document to a word program and print from there.
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
It depends on the program, but usually it's in the "Print" dialogue box.