Question: Im trying to make a simple C++ censorship program but the input is just printed out without the asterisks. Solve and explain please. #include #include
Im trying to make a simple C++ censorship program but the input is just printed out without the asterisks. Solve and explain please.
#include
void cleanLanguage(string &phrase) { //while loop checks if the word is present by checking for an index while (phrase.find("damn") > -1) phrase.replace(phrase.find("damn"), 4, "****");
while (phrase.find("hell") > -1) phrase.replace(phrase.find("hell"), 4, "****");
cout << phrase << endl; }
int main() { string phrase;
cout << "Enter a phrase to be censored: "; getline(cin, phrase); cleanLanguage(phrase);
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
