[Solved] Data File Handling – find count of word in file
The algorithm follows from what you have. Structure your while-loop like this: while(!fin.eof()) { bool found = false; do { fin.get(ch); found = found || ch == ‘d’; } while (ch == ‘d’ && fin); if (found && ch == ‘o’) { // boom goes the dynamite } } The purpose of the do-while is … Read more