ACM去字符串

来源:互联网 发布:接口数据完整性校验 编辑:程序博客网 时间:2024/06/06 19:06
#include <stdio.h> int ridstr(char str[],char cs[]) {     char *p;     int i;     for(p=str;*p!='\0';p++)         for(i=0;p[i]==cs[i];i++)             if(cs[i+1]=='\0')             {                 while(*(p+i+1)!='\0')                     *p++=p[i+1];                 *p='\0';                 return ridstr(str,cs);             }     return 0; } main() {     char str[100],cs[]="ACM";     puts("Please input the string:");     gets(str);     ridstr(str,cs);     printf("The string without \"%s\":\n",cs);     puts(str); }

原创粉丝点击