CHALLENGE 11.4.2: Find char in C string ACTIVITY Assign a pointer to any instance of searchChar in personName to searchR
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
CHALLENGE 11.4.2: Find char in C string ACTIVITY Assign a pointer to any instance of searchChar in personName to searchR
int main() { char personName[100]; char searchChar; char* searchResult = nullptr;
cin.getline(personName, 100); cin >> searchChar;
/* Your solution goes here */
if (searchResult != nullptr) { cout << "Character found." <<endl; } else { cout << "Character not found." <<endl; }
return 0;}
CHALLENGE 11.4.2: Find char in C string ACTIVITY Assign a pointer to any instance of searchChar in personName to searchResult. 397756.2392630.qx3zqy7 1 #include <iostream> 2 #include <cstring> 3 using namespace std; 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 int main() { char personName [100]; char searchChar; char search Result = nullptr; cin.getline (personName, 100); cin >> searchChar; /* Your solution goes here */ if (searchResult != nullptr) { cout << "Character found." << endl; } else { Doll passed