Está en la página 1de 3

#include <iostream>

using namespace std;

int main() {

int N;
int u,d,c,um;
cout << "Ingrese un nmero: ";
cin >> N;
u = N%10; N = N/10;
d = N%10; N = N/10;
c = N%10; N = N/10;
um = N;

//escribir los miles (um)


switch (um)
{case 0: cout << "";break;
case 1: cout << "Mil ";break;
case 2: cout << "Dos Mil ";break;
case 3: cout << "Tres Mil ";break;
case 4: cout << "Cuatro Mil ";break;
case 5: cout << "Cinco Mil ";break;
case 6: cout << "Seis Mil ";break;
case 7: cout << "Siete Mil ";break;
case 8: cout << "Ocho Mil ";break;
case 9: cout << "Nueve Mil ";break;
}

//escribir las centenas (c)


switch (c)
{case 0: cout << "";break;
case 1:
if (d==0 && u==0)
cout << "Cien ";
else
cout << "Ciento ";break;

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


case 3: cout << "Trescientos ";break;
case 4: cout << "Cuatrocientos ";break;
case 5: cout << "Quinientos ";break;
case 6: cout << "Seiscientos ";break;
case 7: cout << "Setecientos ";break;
case 8: cout << "Ochocientos ";break;
case 9: cout << "Novecientos ";break;
}

//escribir las decenas (d)


switch (d)
{case 0: cout << "";break;
case 1:
switch (u) {
case 0: cout << "Diez " << endl;break;
case 1: cout << "Once " << endl;break;
case 2: cout << "Doce " << endl;break;
case 3: cout << "Trece " << endl;break;
case 4: cout << "Catorce " << endl;break;
case 5: cout << "Quince" << endl;break;
case 6: cout << "Diecisis" << endl;break;
case 7: cout << "Diecisiete " << endl;break;
case 8: cout << "Dieciocho" << endl;break;
case 9: cout << "Diecinueve " << endl;break;
} break;

case 2:
switch (u) {
case 0: cout << "Veinte " << endl;break;
case 1: cout << "Veintiuno " << endl;break;
case 2: cout << "Veintids " << endl;break;
case 3: cout << "Veintitrs " << endl;break;
case 4: cout << "Veinticuatro " << endl;break;
case 5: cout << "Veinticinco " << endl;break;
case 6: cout << "Veintisis " << endl;break;
case 7: cout << "Veintisiete " << endl;break;
case 8: cout << "Veintiocho " << endl;break;
case 9: cout << "Veintinueve " << endl;break;
} break;

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


case 4: cout << "Cuarenta ";break;
case 5: cout << "Cincuenta ";break;
case 6: cout << "Sesenta ";break;
case 7: cout << "Setenta ";break;
case 8: cout << "Ochenta ";break;
case 9: cout << "Noventa ";break;

//escribir las unidades (d)


switch (u)
{case 0: cout << "" << endl;break;
case 1:
if (d==0)
cout << "Uno " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Uno " << endl;break;

case 2:
if (d==0)
cout << "Dos " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Dos " << endl;break;
case 3:
if (d==0)
cout << "Tres " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Tres " << endl;break;
case 4:
if (d==0)
cout << "Cuatro " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Cuatro " << endl;break;
case 5:
if (d==0)
cout << "Cinco " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Cinco " << endl;break;
case 6:
if (d==0)
cout << "Seis " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Seis " << endl;break;
case 7:
if (d==0)
cout << "Siete " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Siete " << endl;break;
case 8:
if (d==0)
cout << "Ocho " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Ocho " << endl;break;
case 9:
if (d==0)
cout << "Nueve " << endl;
else if (d==1 || d==2)
cout << "";
else
cout << "y Nueve " << endl;break;

}
return 0;
}