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 #include using namespace std;

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!