write an expression to detect that the first character of the userInput matches the firstLetter.

Sample program:


#include

#include

using namespace std;


int main() {

string userInput;

char firstLetter = '-';


userInput = "banana";

firstLetter = 'b';


if () {

cout << "Found match: " << firstLetter << endl;

}

else {

cout << "No match: " << firstLetter << endl;

}


return 0;

}


print "Censored" if user text contains the word "darn", else print userInput. end with new line.

Sample program:


#include

#include

using namespace std;


int main() {

string userInput;


userInput = "That darn cat.";



return 0;

}


set hadDigit to true if the 3-character passCode contains a digit.

Sample program:


#include

#include

#include

using namespace std;


int main() {

bool hasDigit = false;

string passCode;

int valid = 0;


passCode = "abc";




if (hasDigit) {

cout << "Has a digit." << endl;

}

else {

cout << "Has no digit." << endl;

}


return 0;

}


Replace any space ' ' by '_' in 2-character string passCode.

Sample program:


#include

#include

#include

using namespace std;


int main() {

string passCode;


passCode = "1 ";




cout << passCode << endl;

return 0;

}