this function should read a file word by word and it does work till the last word, where the run stops
void readFile( ) { ifstream file; file.open
I have edited the function for you,
void readFile() { ifstream file; file.open ("program.txt"); if (!file.is_open()) return; string word; while (file >> word) { cout<< word << '\n'; } }