该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
int main()
{
int a,b,c,d,e,n,f;
while (scanf("%d", &a) != EOF)
{
if (a >= 0 && a <= 9999)
{
if (a >= 1000 && a < 10000)
{
switch (n = a / 1000)
{
case 9: printf("九千");
break;
case 8: printf("八千");
break;
case 7: printf("七千");
break;
case 6: printf("六千");
break;
case 5: printf("五千");
break;
case 4: printf("四千");
break;
case 3: printf("三千");
break;
case 2: printf("二千");
break;
case 1: printf("一千");
break;
}
n = (a / 100) % 10;
switch (n)
{
case 9: printf("九百");
break;
case 8: printf("八百");
break;
case 7: printf("七百");
break;
case 6: printf("六百");
break;
case 5: printf("五百");
break;
case 4: printf("四百");
break;
case 3: printf("三百");
break;
case 2: printf("二百");
break;
case 1: printf("一百");
break;
case 0: printf("零");
break;
}
n = (a / 10) % 10;
switch (n)
{
case 9: printf("九十");
break;
case 8: printf("八十");
break;
case 7: printf("七十");
break;
case 6: printf("六十");
break;
case 5: printf("五十");
break;
case 4: printf("四十");
break;
case 3: printf("三十");
break;
case 2: printf("二十");
break;
case 1: printf("一十");
break;
case 0: printf("零");
break;
}
n = a % 10;
switch (n)
{
case 9: printf("九");
break;
case 8: printf("八");
break;
case 7: printf("七");
break;
case 6: printf("六");
break;
case 5: printf("五");
break;
case 4: printf("四");
break;
case 3: printf("三");
break;
case 2: printf("二");
break;
case 1: printf("一");
break;
}
}
else if (a < 1000 && a >= 100)
{
n = a / 100;
switch (n)
{
case 9: printf("九百");
break;
case 8: printf("八百");
break;
case 7: printf("七百");
break;
case 6: printf("六百");
break;
case 5: printf("五百");
break;
case 4: printf("四百");
break;
case 3: printf("三百");
break;
case 2: printf("二百");
break;
case 1: printf("一百");
break;
}
n = (a / 10) % 10;
switch (n)
{
case 9: printf("九十");
break;
case 8: printf("八十");
break;
case 7: printf("七十");
break;
case 6: printf("六十");
break;
case 5: printf("五十");
break;
case 4: printf("四十");
break;
case 3: printf("三十");
break;
case 2: printf("二十");
break;
case 1: printf("一十");
break;
case 0: printf("零");
break;
}
n = a % 10;
switch (n)
{
case 9: printf("九");
break;
case 8: printf("八");
break;
case 7: printf("七");
break;
case 6: printf("六");
break;
case 5: printf("五");
break;
case 4: printf("四");
break;
case 3: printf("三");
break;
case 2: printf("二");
break;
case 1: printf("一");
break;
}
}
else if (a >= 10 && a < 100)
{
n = a / 10;
switch (n)
{
case 9: printf("九十");
break;
case 8: printf("八十");
break;
case 7: printf("七十");
break;
case 6: printf("六十");
break;
case 5: printf("五十");
break;
case 4: printf("四十");
break;
case 3: printf("三十");
break;
case 2: printf("二十");
break;
case 1: printf("十");
break;
}
n = a % 10;
switch (n)
{
case 9: printf("九");
break;
case 8: printf("八");
break;
case 7: printf("七");
break;
case 6: printf("六");
break;
case 5: printf("五");
break;
case 4: printf("四");
break;
case 3: printf("三");
break;
case 2: printf("二");
break;
case 1: printf("一");
break;
}
}
else if (a >= 0 && a < 10)
{
switch (a)
{
case 9: printf("九");
break;
case 8: printf("八");
break;
case 7: printf("七");
break;
case 6: printf("六");
break;
case 5: printf("五");
break;
case 4: printf("四");
break;
case 3: printf("三");
break;
case 2: printf("二");
break;
case 1: printf("一");
break;
case 0: printf("零");
break;
}
}
printf("\n");
}
}
return 0;
}