非常轻松的小东西,输入一串字符串,然后输入要删除的内容,就能把他删除啦!
#include <stdio.h>
void DelChar(char s[], char ch)
{
int i,j;
char g[100];
for(i=j=0;s[i]!='\0';i++)
if(s[i]!=ch)
{
g[j]=s[i];
j++;
}
puts(g);
}
int main()
{
char s[888],ch;
printf("输入字符串");
gets(s);
printf("输入你想要去除的字母\n");
scanf("%s",&ch);
DelChar(s,ch);
return 0;
}