I have two text files that I am trying to compare (test.txt and removewords.txt. If a word from removetext.txt is found in test.txt it should be excluded from the output; otherwise it should be displayed. Here is my code:
while ( inClientFile >> word )
{
while ( inIgnoreFile >> ignoreWord )
{
int result = word.compare( ignoreWord );
if (result == 0)
{
//erase word from output
//i have tried to use word.erase to no avail as well finding
//the length of the string "word" and deleting it that way.
}
else
cout << word << endl;
}
}
Is there a better way to go about this than what I am trying here?