- #1
ineedhelpnow
- 651
- 0
Write an expression to detect that the first character of userInput matches firstLetter.
Sample program:
i tried userInput.find(firstLetter, 1) but it only partially passed
Sample program:
Code:
#include <iostream>
#include <string>
using namespace std;
int main() {
string userInput;
char firstLetter = '-';
userInput = "banana";
firstLetter = 'b';
if (<STUDENT CODE>) {
cout << "Found match: " << firstLetter << endl;
}
else {
cout << "No match: " << firstLetter << endl;
}
return 0;
}