Advanced 1005 Spell It Right(20 分)

PAT题目链接

#include 
#include 
const int N=105;
const char words[10][10]=
        {"zero","one","two","three","four",
         "five","six","seven","eight","nine"};
int main() {
    char str[N];
    while (scanf("%s", str) != EOF) {
        int len=strlen(str),ans=0;
        for(int i=0;i=100){
            printf("%s %s %s\n",words[ans/100],words[ans/10%10],words[ans%10]);
        } else if(ans>=10){
            printf("%s %s\n",words[ans/10],words[ans%10]);
        } else{
            printf("%s\n",words[ans]);
        }
    }
    return 0;
}

你可能感兴趣的:(Advanced 1005 Spell It Right(20 分))