#include #include #include using namespace std; void main() { string wordlist[120000]; ifstream win("/home/www/dics/knuthus.txt"); if (win.fail()) { cout << "Couldn't open the word list\n"; exit(1); } int numwords = 0; while (true) { string word; win >> word; if (win.fail()) break; wordlist[numwords] = word; numwords = numwords + 1; } win.close(); cout << numwords << " words successfully read\n"; ifstream story("story.txt"); if (story.fail()) { cout << "Couldn't open the file\n"; exit(1); } while (true) { string word; story >> word; if (story.fail()) break; int i = 0; bool matched = false; while (i < numwords) { if (wordlist[i] == word) matched = true; i = i+1; } cout << word; if (matched) cout << " is OK\n"; else cout << " is no good\n"; } story.close(); cout << "All done\n"; }