I'm new to cplusplus.com, and I am only in computer science 2, so i am still pretty new at all this. I have a project due for my class that requires me to create a hash table with 13 lists and the file it is reading from is the US Constitution. At first with this, I couldn't even get the file to open, but then I remembered I didn't #include it in my main.cpp file. Now, my problem is that it is kicking back a TON of errors that are directly from the txt file, some examples being "'nor' doesn't have a type" or "'they' doesn't have a a type" which doesn't make any sense to me because it is just a .txt file. My code for reading the text file is this:
st.open("usconst.txt");
if (st.is_open()){
while(! st.eof()){
getline (st, word);
cout << word << endl;
}
st.close();
}
else{
cout << "Unable to open file." << endl;
}
st.close();
t.display();
cout << "testing" << endl;
Before I had #include "usconst.txt", the program compiled and ran all the way through with success. (Keep in mind, I'm not done with the project, but I need this part fixed before I can make tweaks to the rest of my files). Any help would be greatly appreciated! Thank you. The code, if any suggestions pop up, have to be in c++.