#include<stdio.h>
#include<string.h>
void s_fun(int a)
{
int k;
k=a;
switch(k)
{
case 1:
printf("一");break;
case 2:
printf("二");break;
case 3:
printf("三");break;
case 4:
printf("四");break;
case 5:
printf("五");break;
case 6:
printf("六");break;
case 7:
printf("七");break;
case 8:
printf("八");break;
case 9:
printf("九");break;
default:
break;
}
}
void k_fun(int b,char *buf)
{
int t=b;
switch(t)
{
case 8:
if(buf[8] == 0)
;
else
printf("亿");break;
case 7:
if( buf[7] == 0 )
if( buf[6] == 0)
;
else
printf("零");
else
printf("千");break;
case 6:
if( buf[6] == 0 && buf[7] == 0 )
if( buf[5] == 0 )
;
else
printf("零");
else if( buf[6] == 0 && buf[7] != 0 )
printf("零");
else if( buf[6] != 0 && buf[7] != 0)
printf("百");
else if( buf[6] != 0 && buf[7] == 0 )
printf("百");break;
case 5:
if( buf[5] == 0 && buf[6] == 0 && buf[7] == 0 )
if( buf[4] == 0)
;
else
printf("零");
else if( buf[5] == 0 && buf[6] != 0 && buf[7] != 0 )
if( buf[4] == 0)
;
else
printf("零");
else if( buf[5] == 0 && buf[6] == 0 && buf[7] != 0 )
if( buf[4] == 0 )
;
else
printf("零");
else if( buf[5] != 0 && buf[6] == 0 && buf[7] != 0 )
;
else if( buf[5] != 0 && buf[6] != 0 && buf[7] == 0 )
printf("十");
else if( buf[5] == 0 && buf[6] != 0 && buf[7] == 0 )
if( buf[4] == 0 )
;
else
printf("零");
else if( buf[5] != 0 && buf[6] == 0 && buf[7] == 0 )
printf("十");
else if( buf[5] != 0 && buf[6] != 0 && buf[7] != 0 )
printf("十");
else
;break;
case 4:
if( buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0 )
;
else if( (buf[4] != 0 || buf[5] != 0 || buf[6] != 0 || buf[7] != 0) == 1 )
printf("万");break;
case 3:
if( buf[3] == 0 )
if( buf[2] == 0 )
;
else
printf("零");
else
printf("千");break;
case 2:
if( buf[2] == 0 && buf[3] == 0 )
if( buf[1] == 0 )
;
else
printf("零");
else if( buf[2] == 0 && buf[3] != 0 )
printf("零");
else if( buf[2] != 0 && buf[3] != 0 )
printf("百");
else if( buf[2] != 0 && buf[3] == 0 )
printf("百");break;
case 1:
if( buf[1] == 0 && buf[2] == 0 && buf[3] == 0 )
if( buf[0] == 0)
;
else
printf("零");
else if( buf[1] == 0 && buf[2] != 0 && buf[3] != 0 )
if( buf[0] == 0)
;
else
printf("零");
else if( buf[1] == 0 && buf[2] == 0 && buf[3] != 0 )
if( buf[0] == 0)
;
else
printf("零");
else if( buf[1] != 0 && buf[2] == 0 && buf[3] != 0 )
;
else if( buf[1] != 0 && buf[2] != 0 && buf[3] == 0 )
printf("十");
else if( buf[1] == 0 && buf[2] != 0 && buf[3] == 0 )
if( buf[0] == 0)
;
else
printf("零");
else if( buf[1] != 0 && buf[2] == 0 && buf[3] == 0 )
printf("十");
else if( buf[1] != 0 && buf[2] != 0 && buf[3] != 0 )
printf("十");
else
;break;
default:
break;
}
}
int main()
{
int m,s,flag=0;
char buf[21];
printf("Please input integer:\n");
scanf("%d",&m);
while( m > 0 )
{
s=m%10;
buf[flag]=s;
m/=10;
flag++;
}
while(flag-- >= 0)
{
s_fun(buf[flag]);
k_fun(flag,buf);
}
}