/*
在使用 scanf("%c",&remove) 获取要删除的字符时,可能会遇到换行符等问题。
这是因为之前的 scanf 函数读取了输入缓冲区中的换行符,导致接下来的 scanf 函数无法正确获取字符。
可以通过在格式字符串中添加一个空格来解决这个问题:scanf(" %c", &remove)
*/
#include<stdio.h>
#include<string.h>
int main()
{
char a[100];
char b[100];
int i,n,j=0;
char remove;
scanf("%s",a);
scanf(" %c",&remove);//
n=strlen(a);文章来源:https://uudwc.com/A/rZ615
for(i=0; i<n; i++)
{
if(a[i]==remove) continue;
else
b[j++]=a[i];
}
b[j]='\0';
printf("%s",b);
return 0;
}文章来源地址https://uudwc.com/A/rZ615