Im trying to import a text file which holds all dictionary words to be used to solve an algorithm to predict words by adding one letter to the beginning, and one letter to the end.
My problem is before even beginning on how to write the logic for this I can't seem to load the dictionary into a set. We are supposed to use a set. I have read over STL's and sample programs but haven't made much progress... Here is what I have.
You can't insert a fstream into your set since it is defined as set<string>.
You need to read dictfile a record at a time and insert each word into the set.
1 2 3
string word;
while (dictfile >> word)
Dictonary.insert(word);
Each line has a word, this doesn't seem to load properly seeing how the line "Press any key to continue" pops up immediately. A dictionary of this size (4.7mb) should take a little bit to load into a set right??
Here is what I have
1 2 3 4 5 6
while (getline(dictFile,word))
{
std::getline(dictFile, word);
Dictonary.insert(word);
}