Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions