题目链接:http://ac.jobdu.com/problem.php?pid=1049
题目分析:
输入字符串,再输入剔除的字符,用一个for循环,将字符串中的剔除字符剔除,打印输出。
源代码:
#include <iostream>
#include <string>
using namespace std;
int main()
{
string s; //字符串
while (cin>>s)
{
char c; //剔除的字符
cin>>c;
for (int i = 0; i < s.length(); i++)
{
if (s[i] != c) //判断
{
cout<<s[i];
}
}
cout<<endl;
}
return 0;
}