Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Searching for substring) 1)Write a program that inputs a line of text and a sea

ID: 3634839 • Letter: #

Question

(Searching for substring)

1)Write a program that inputs a line of text and a search string from the keyboard. Using function strstr, locate the first occurrene of the search string in the line of text, and assignthe location t variable searchPtr of type char*. If the search string is found, print the remainder of the line of text beginning with the search string. Then use strstr again to locate the next occurrence o the search string in the line of text. If a second occurrence is found, print the remainder if the line of txt beginning with the second occurence. (Hint: Second call to strstr should contain the expressin searchPtr + 1 as its first argument.)

2)Then, write program based on program made by following instruction above, that input several lines oftext and a search string, then uses function strstr to determine the otal number of occurrences of the string in the lines of text. Print the result.

-Please classify and separate if you answer have several part.

-Please post screenshot when you post answer.

Explanation / Answer

#include #include #include using namespace std; int main() { char sent[81]; char find[81]; char *ptr; int i; int count=0; cout