I'm trying to make a program that reads a text file line-by-line, breaks it up into words, and checks a vector to see if the word is already in the vector. If the word isn't already in the vector, I need to add it to the vector and if it's already present, nothing happens.
My program correctly splits the text files up word by word, but the find algorithm is giving me issues. I have started with a blank string vector(called first_file) for the words to be added to.
I've tried all kinds of variations of std::find(first_file.begin(), first_file.end(), processed_word); However, I keep getting errors such as: Request for member 'begin' in 'first file' which is of non-class type 'std::vector<std::basic string<char> >()'
How do I get it to read the vector and check if the string processed_word is present in the vector and if it's not, add it?
Thanks for any help/suggestions :)
1 2 3
|
std::find(first_file.begin(), first_file.end(), processed_word);
ERROR: Request for member 'begin' in 'first file' which is of non-class type 'std::vector<std::basic string<char> >()'
|