首页 > 代码库 > 就我不坑

就我不坑

/*描述as we all know ,就我不坑,呵呵,当然,这次我还是不坑,我只让你帮我翻译一下数字即可。所谓翻译,就是将一个数字用中文读出来,很简单吧,快快AC吧。数字的中文表示分别为:零、壹、贰、叁、肆、伍、陆、柒、捌、玖、拾、佰、仟、万、亿.输入int 范围内,保证没错,EOF。输出用我给你的中文写出来就好了样例输入10105210000样例输出壹拾壹仟零伍拾贰壹万 提示我真的不坑。 *//*请输入4位数字:1245壹千贰百肆十伍 */#include <stdio.h>#include "string.h"int main(int argc, const char * argv[]) {    // insert code here...        int n;    printf("请输入4位数字:\n");    scanf("%d",&n);    int  a,b,c,d;    //个位    d=n%10;    //十位    c=n%100/10;    //百位    b=n%1000/100;    //千位    a=n/1000;            char *s[255]={"","","","","","","","","",""};            if (a==0&&b==0&&c==0&&d!=0) {        printf("%s\n",s[d]);    }else if (a==0&&b==0&&c!=0&&d!=0){        printf("%s十%s\n",s[c],s[d]);    }else if (a==0&&b==0&&c!=0&&d==0){        printf("%s十\n",s[d]);    }else if (a==0&&b!=0&&c!=0&&d!=0){        printf("%s百%s十%s\n",s[b],s[c],s[d]);    }else if (a==0&&b!=0&&c!=0&&d==0){        printf("%s百%s十\n",s[b],s[c]);    }else if (a==0&&b!=0&&c==0&&d==0){        printf("%s百\n",s[b]);    }else if (a!=0&&b!=0&&c!=0&&d!=0){        printf("%s千%s百%s十%s\n",s[a],s[b],s[c],s[d]);    }else if (a!=0&&b!=0&&c!=0&&d==0){        printf("%s千%s百%s十\n",s[a],s[b],s[c]);    }else if (a!=0&&b!=0&&c==0&&d==0){        printf("%s千%s百\n",s[a],s[b]);    }else if (a!=0&&b==0&&c==0&&d==0){        printf("%s千\n",s[a]);    }else if (a!=0&&b==0&&c==0&&d!=0){        printf("%s千零%s\n",s[a],s[d]);    }else{        printf("请输入正确的数字!!\n");    }    return 0;}

 

就我不坑