char * myStrCat(char *dest, const char *res) {
return strcat(strcat(dest, res), " ");
}
int main(){
int value=0;
char buffer[100] = {""};
printf("输入值:");
scanf("%d", &value);
while(value != 0) {
int flag = value % 10;
switch (flag) {
case 0:
myStrCat(buffer, "ZERO");
break;
case 1:
myStrCat(buffer, "ONE");
break;
case 2:
myStrCat(buffer, "TWO");
break;
case 3:
myStrCat(buffer, "THREE");
break;
case 4:
myStrCat(buffer, "FOUR");
break;
case 5:
myStrCat(buffer, "FIVE");
break;
case 6:
myStrCat(buffer, "SIX");
break;
case 7:
myStrCat(buffer, "SEVEN");
break;
case 8:
myStrCat(buffer, "EIGHT");
break;
case 9:
myStrCat(buffer, "NINE");
break;
default:
break;
}
value /= 10;
}
printf("输出的英文:%s\n", buffer);
return 0;
}
给分吧,我写给你