采用字符串匹配算法。网上有答案
#include
using namespace std;
int main()
{
char s1[100],s2[100],c;
cin >> s1;
cin.get();
cin >> c;
for (int i = 0;i < 100;i ++)
s2[i] = '\0';
for (int i = 0,j = 0;s1[i] != '\0';i ++)
if (s1[i] != c)
s2[j ++] = s1[i];
cout << s2 << endl;
return 0;
}