Question: Hello, I need help solving this Lab simulation, It uses white string looking for characters statements and I am very new at coding on this
Hello, I need help solving this Lab simulation, It uses white string looking for characters statements and I am very new at coding on this subject so I need help solving it. I can't seem to get the right code to get the second output?
if your input was "banana", 'b' then your output would be Found match: b
if your input was "abacus", 'c' then your output would be No match: c
An expression to detect that the first character of userInput matches firstLetter.
#include
#include
using namespace std;
int main() {
string userInput;
char firstLetter = '-';
userInput = "banana";
firstLetter = 'b';
if (/* Your solution goes here*/) {
cout << "Found match: " << firstLetter << endl;
}
else {
cout << "No match: " << firstLetter << endl;
}
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
