rastafari
New Coder
My program blocks words when they are separate but when you add anything it does not censor it. Example ----delta--- should be blocked but does not. Not sure where the problem is, I'm very new to c++
C++:
int main()
{
string bad[] = {"alpha", "beta", "gamma", "delta"};
set<string> bad_words(bad, bad + sizeof(bad) / sizeof(string));
string input;
while(cin >> input)
{
if (bad_words.find(input)!=bad_words.end()){
cout << "CENSORED ";
}
else {
cout << input << " ";
}
}
}
Last edited by a moderator: