for example the sentence in the text file is "daniweb offers the best solutions for C++. the website is www.daniweb.com."
i have the user to search the word "daniweb".
by using ifstream to read word by word, this is part of my codes
ifstream file ("lines.txt");
string word;
bool found = true;
while(!file.eof())
{ file>>word;
char c = word[word.size()-1]; // to check for the last character in the string contain any punctation marks
if (c == '.' || c == '?' || c == '!')
{ if (found)
cout << sentence << endl;
}
}
for this instance, it was able to print out both sentence line by line.
but is there any way for me to check the second sentence for the '.' between the url given so that the second sentence will be printed out as "daniweb."
Thanks in advance!