Hi, there im a new member, I have a few questions. i am having a problem i am trying tp find words that are related together by one word for example "dous" Tremendous,stupendous ect... I have my code working so that it goes through my text file and picks out all of the dous in the file, but how do i get the CMD to not only show "dous" when it is found, but the whole word" im a bit confused :-/.
here is my code:
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main ()
{
char* search = "dous";
int offset;
string TEXT;
ifstream in_stream;
in_stream.open("words.txt");
if(in_stream.fail())
{
cout<<"File will not open, file possible dont exist or is corrupted"<<endl;
exit(1);
}
if( in_stream.is_open())
{
while(!in_stream.eof())
{
getline(in_stream,TEXT);
if ((offset = TEXT.find(search, 0)) != string::npos)
{
cout << "found " << search << endl;
}
}
}
system("pause");
in_stream.close();
}