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