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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started