-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnumeros romanos a arabigos.cpp
128 lines (112 loc) · 1.89 KB
/
numeros romanos a arabigos.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
void proceso();
void finalizar();
int main(){
proceso();
finalizar();
return 0;
}
void proceso(){
int u,d,c,m,numero;
cout<<"Escriba un numero a convertir: "<<endl;cin>>numero;
u = numero%10;
numero /= 10;
d = numero%10;
numero /= 10;
c = numero % 10;
numero /= 10;
m = numero % 10 ;
numero /= 10;
switch(m){
case 1: cout<<"M";
break;
case 2: cout<<"MM";
break;
case 3: cout<<"MMM";
break;
}
switch(c){
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(d){
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(u){
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;
}
}
void finalizar(){
int opc;
bool opc2=false;
do{
cout<<"\nDeseas repetir el programa? SI=1 NO=2"<<endl;cin>>opc;
if(opc==1){
system("cls");
main();
}else if(opc==2){
system("cls");
cout<<"Hasta luego......."<<endl;
exit(0);
}
else{
system("cls");
cout<<"Esta opcion no existe "<<endl;
opc2=true;
}
}while(opc2==true);
}