0% found this document useful (0 votes)
20 views2 pages

Include

The program takes a number as input from the user, separates the number into thousands, hundreds, tens, and ones places, and then outputs the corresponding Roman numeral for each place value using switch statements. It converts the Arabic numeral input into its Roman numeral equivalent.

Uploaded by

mamanijachoelvis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Include

The program takes a number as input from the user, separates the number into thousands, hundreds, tens, and ones places, and then outputs the corresponding Roman numeral for each place value using switch statements. It converts the Arabic numeral input into its Roman numeral equivalent.

Uploaded by

mamanijachoelvis
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

int num, uni, dece, cente, millar;

cout<<"ingrese un numero: ";cin>>num;

uni=num%10; num/=10;

dece=num%10; num/=10;

cente=num%10; num/=10;

millar=num%10; num/=10;

switch (millar){

case 1: cout<<"M";break;

case 2: cout<<"MM";break;

case 3: cout<<"MMM";break;

switch (cente){

case 1: cout<<"C";break;

case 2: cout<<"CC";break;

case 3: cout<<"CCC";break;

case 4: cout<<"CD";break;

case 5: cout<<"D";break;

case 6: cout<<"DC";break;

case 7: cout<<"DCC";break;

case 8: cout<<"DCCC";break;
case 9: cout<<"CM";break;

switch (dece){

case 1: cout<<"X";break;

case 2: cout<<"XX";break;

case 3: cout<<"XXX";break;

case 4: cout<<"XL";break;

case 5: cout<<"L";break;

case 6: cout<<"LX";break;

case 7: cout<<"LXX";break;

case 8: cout<<"LXXX";break;

case 9: cout<<"XC";break;

switch (uni){

case 1: cout<<"I";break;

case 2: cout<<"II";break;

case 3: cout<<"III";break;

case 4: cout<<"IV";break;

case 5: cout<<"V";break;

case 6: cout<<"VI";break;

case 7: cout<<"VII";break;

case 8: cout<<"VIII";break;

case 9: cout<<"IX";break;

return 0;

system("PAUSE");

return EXIT_SUCCESS;

You might also like