#include "
stdio.h"
#include "math.h"
int main(void)
{
char input[100];
printf("Please input the array(int):");
gets(input);
for(int i = 0; i < 100; i++ ){
if(input[i] >= '0' && input[i] <= ' 9'){
switch(input[i]){
case '0':
printf("zero");
break;
case '1':
printf("one");
break;
case '2':
printf("two");
break;
case '3':
printf("three");
break;
case '4':
printf("four");
break;
case '5':
printf("five");
break;
case '6':
printf("six");
break;
case '7':
printf("seven");
break;
case '8':
printf("eight");
break;
case '9':
printf("nine");
break;
default:
break;
}
printf(" ");
}else
break;
}
printf("\n");
return 0;
}
在输入的末尾,加一个非数字的字符就ok~