#include "stdio.h"
#include "string.h"
void main()
{
char str[500];
int i;
printf("请输入字符串:\n");
gets(str);
for(i=0;i
if(str[i]==' '||(str[i]>='0'&&str[i]<='9'))
continue;
else
printf("%c",str[i]);
}
printf("\n");
}
给:
#include
#define N 50
void delchar (char *p)
{
char *q=p;
for (;*p!=NULL;p++)
if((*p<'0')||(*p>'9'))
*q++=*p;
*q='\0';
}
int main(void)
{
char c[N]={NULL},*pt=c;
printf("enter a string:");
gets(pt);
delchar (pt);
printf ("%s\n",c);
return 0;
}