This code would need to be in the constructor and you would need to pass the filename to it.
Code:ifstream file("dictionary.txt"); if(!file) { cout <<"\nError! The file couldn't be opened\n"; } vector<string> word_list; string word; while(file >> word) { word_list.push_back(word); }