#include <iostream>
#include <string>
#include <locale>
#include <cstdlib>
using namespace std;
int main(void)
{
wcin.imbue( locale( "korean" ) );
wcout.imbue( locale( "korean" ) );
const int bottom=0, top=100;
int source;
for( ;; ) // loop infinity
{
wcout << bottom << L"부터 " << top;
wcout << L"까지의 자연수를 입력해주세요." << endl;
wcin >> source;
if( source>=bottom && source<=top )
break;
else
wcout << L"입력형식이 잘못되었습니다. 다시 입력해주세요." << endl;
}
wstring unit( L"십백천만" );
wstring num( L"일이삼사오육칠팔구" );
wstring output;
for( int i=source,j=-1 ;; i/=10,++j ) // no condition.
{
if( j==-1 && ( i%10 != 0 ) )
output = num.substr( ( i%10 )-1, 1 );
else if( i%10 != 0 )
output = num.substr( ( i%10 )-1, 1 )+unit.substr( j, 1 )+output;
else if( source == 0)
output = L"영";
else
; // do nothing;
if( i < 10 )
break;
}
wcout << output << endl;
return EXIT_SUCCESS;
}