#include <iostream>
using namespace std;
void deDecimalATexto( int numero );
int main ()
{
int numero;
cout << "Ingrese un numero entero (0 - 99): ";
cin >> numero;
if( numero < 0 || numero > 99 )
numero = 0;
cout << endl;
deDecimalATexto( numero );
cout << endl;
return 0;
}
void deDecimalATexto( int numero )
{
int unidades, decenas;
if( numero == 0 )
cout << "Cero";
unidades = numero % 10; numero /= 10;
decenas = numero % 10; numero /= 10;
switch( decenas )
{
case 1: cout << "Diez "; break;
case 2:
if( unidades != 0 )
cout << "Veinti";
else
cout << "Veinte ";
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;
}
if( decenas != 0 && decenas != 2 && unidades != 0 )
cout << "y ";
switch( unidades )
{
case 1: cout << "Uno "; break;
case 2: cout << "Dos "; break;
case 3: cout << "Tres "; break;
case 4: cout << "Cuatro "; break;
case 5: cout << "Cinco "; break;
case 6: cout << "Seis "; break;
case 7: cout << "Siete "; break;
case 8: cout << "Ocho "; break;
case 9: cout << "Nueve "; break;
}
}