Menu

[solved] – Question 99430

Write an expression to detect that the first character of userInput matches firstLetter.
#include <iostream>
#include <string>
using namespace std;

int main() {
string userInput;
char firstLetter;

getline(cin, userInput);
cin >> firstLetter;

if (/* Your solution goes here */) {
cout << “Found match: ” << firstLetter << endl;
}
else {
cout << “No match: ” << firstLetter << endl;
}

return 0;
}

Expert Answer


OR


Leave a Reply

Your email address will not be published. Required fields are marked *