Computer Science, asked by kolliboyenam, 7 months ago


1) Write a program to read a string and find out a word is
present in that string and also print starting index of the
word using strstr().
Input:
Istr1=" Was this the face that launch'd a thousand ships",
Str2="face";
Output:
String 'face' was found at position 14 in string 'Was this the face that launch'd a thousand ships'​

Answers

Answered by pushpajaiswal1089
0

Answer:

C++, std::strstr() is a predefined function used for string handling. string.h is the header file required for string functions.

This function takes two strings s1 and s2 as an argument and finds the first occurrence of the sub-string s2 in the string s1. The process of matching does not include the terminating null-characters(‘\0’), but function stops there.

Similar questions