How to extract a sentences of word from a text file.

Hi ,

i have a text file that contain a story

How do i extract the out all the sentences that contain the word Mon. in C++

I only want to show those sentences that contain the word mon

eg.
Monkey on a tree.
Rabbit jumping around the tree.
I am very rich, I have lots of money.
Today is monday.
tomorrow is tuesday.

but only those words that contain the word mon is show.
Monkey on a tree
<Press enter to continue or q to quit>
I have lots of money
<Press enter to continue or q to quit>
Today is monday
<Press enter to continue or q to quit>

any advices on that

below is my codes, but it come out as a chunk of word that i search for.

#include <iostream>
#include <fstream>

using namespace std;


int main()

{
ifstream fin;
char filename[50];
string searchword;
string s;
int count;

cout << "Enter filename (including .txt): ";
cin >> filename;

fin.open(filename);

// stores Search Word
string askforsearchword();
searchword = askforsearchword();

// ends program if no txt file is found
if (!fin.good())
{
cout << "File not found" << endl;
system("pause");
return 1;
}

while(!fin.eof())
{

// use getline to read entire line 

getline(fin, s);


int i, position;

//converts text to all lowercase

for (i=0; i<s.length();i++)
s=tolower(s);
for (i=0; i<searchword.length();i++)
searchword=tolower(searchword); 


position = s.find(searchword);


if (position != string :: npos)

{

cout << s << endl;

}


} 


fin.close();


cout << "End Of Search." << endl;

system("pause");
return 0;

}

//function to ask for search word.
string askforsearchword()
{
string search;
cout<< "Type in your Search Word: " << endl;
cin >> search;
return search;
}

This sounds like homework, but since you have actually posted some working code, I'll give you the benefit of the doubt.

You must concatenate s until you find an end-of-sentence delimiter. An end-of-sentence delimiter should look like one of: ". ", "! ", "? ". So first, you do a find for each of these strings, and if not sound, you concatenate the entire line to s. When you do find one, you split the line, concatenating the first part to s, and leaving the remainder for the next sentence (new variable). Then you search s for your target string. Then you replace s with the remainder of the sentence, and continue your loop.