I'm making a program where a user will input his string and then there's a thing where you could search a word or phrase from the string.
Here's my code:
1 2 3 4 5 6
if (!(strncmp(blog,search,strlen(search))))
{
cout<<"The word or phrase is FOUND at this blog.";
}
else
cout<<"Word or phrase NOT FOUND on this blog.";
where blog and search is a char string.
Now, lets say this is the input:
1 2
Enter your blog: This is abry and I have a problem
Enter word to be searched: abry
Output: The word or phrase is FOUND at this blog.
But when I make this my input:
1 2
Enter your blog: Good morning everyone. This is abry and I have a problem.
Enter word to be searched: abry
The output becomes: Word or phrase NOT FOUND on this blog.
Please help. I know it has something to do with when I make multiple sentences or phrases. It works fine without period, exclamation point, question mark, etc.