Question: C-string::find In this lab, you'll be writing a find() function that accepts two C-style strings (const char*, terminated with '0'), an input string and a
C-string::find
In this lab, you'll be writing a find() function that accepts two C-style strings (const char*, terminated with '\0'), an input string and a target string, and it should return a vector. The elements in this vector should be pointers to every place the target string shows up inside the input string.
For example, if the target string is "I" and the input string is "In three words I can sum up everything I've learned about life: it goes on.", find() should return a vector with pointers to the "I" of "In", the "I" before "can", and the "I" of "I've" (but not the "i" of "it").
#include
vector
int main() { string str, tgt; getline(cin, str); getline(cin, tgt); vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
