#include #include #include using namespace std; int main() { string fileName; ifstream inFile; string line; cout << "Enter the file name " ; cin >> fileName; inFile.open(fileName); // probably what you were told to do /* getline(inFile, line); while (inFile) { cout << "The line is \"" << line << "\"" << endl; getline(inFile, line); } */ // also good /* while (getline(inFile,line)) { cout << "The line is \"" << line << "\"" << endl; } */ // wrong wrong wrong wrong wrong /* while (inFile) { getline(inFile, line); cout << "The line is \"" << line << "\"" << endl; } */ // sort of works. /* while (not inFile.eof()) { getline(inFile, line); cout << "The line is \"" << line << "\"" << endl; } */ /* while (inFile) { getline(inFile, line); if (inFile) { cout << "The line is \"" << line << "\"" << endl; } } */ inFile.close(); return 0; }