Im trying to make a simple C++ censorship program but the input is just printed out without the asterisks. Solve and explain please.
#include <iostream>
#include <string>
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;
}