#include #include #include #include "WordT.h" #include #include using namespace std; int main() { vector words; WordT newWord; string word; vector::iterator pos; string tmp; ifstream inFile{"ocap.txt"}; while (inFile >> word) { tmp = ""; for (auto c: word) { if (isalpha(c) ) { tmp += static_cast(tolower(c)); } } word = tmp; if (word != "") { newWord.Word(word); pos = find(begin(words), end(words), newWord); if (pos == end(words) ) { words.push_back(newWord); } else { pos->Increment(); } } } inFile.close(); sort(words.begin(), words.end()); for(auto x:words) { cout << x << endl; } return 0; }