去掉字符串中的数字 C语言
题目:从键盘上输入字符串a,将字符串a中除去数字字符0’~9之后的其它字符保留在字符串b中,并输出字符串b。
#define NUM 32
int main(void) {
char a[NUM],b[NUM];
printf("please enter a:");
gets(a);
int i=0,j=0;
while(a[i]!='\0'){
while(a[i]>='0' && a[i]<='9'){
i++;
}
b[j++]=a[i++];
}
printf("str b:");
puts(b);
return 0;
}
还没有评论,来说两句吧...