Linda Scott asked · 3 years ago

Write an expression to detect that the first character of userinput matches firstletter.

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 - 0

Get Online Tutoring or Questions answered by Experts.

You can post a question for a tutor or set up a tutoring session

Related Questions

Join Thousands of Happy Students!

Post a Question