Question: Hello, I need help solving this Lab simulation, It uses Find char in C string for Inheritance & Composition statements and I am very new
Hello, I need help solving this Lab simulation, It uses Find char in C string for Inheritance & Composition statements and I am very new at C++ on so I need help solving it. It is very difficult. It is very confusing since the there are multiple inputs and and multiple files for h. cpp. and main function can only code one input in the simulation.
Assign a pointer to any instance of searchChar in personName to searchResult.
#include
#include
using namespace std;
int main() {
char personName[100] = "Albert Johnson";
char searchChar;
char* searchResult = nullptr;
searchChar = 'J';
/* Your solution goes here*/
if (searchResult != nullptr) {
cout << "Character found." << endl;
}
else {
cout << "Character not found." << endl;
}
return 0;
}
I can't change the input on the code char personName[100] = "Albert Johnson"; I have to code this without changing that part of the code. Please try to use the input Searching for J in: Hubert and the expected output should be Character not found.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
