// Main.cpp #include #include #include "CyrIOS.h" // for Visual C++ 6.0 using namespace std; bool equal(const string& cw, const string& w) { char punct[] = {'.',',','?','!'}; if (cw == w) return true; for (int i=0; i < sizeof(punct); ++i) if (cw == w + punct[i]) return true; return false; } int main() { string word, curword; cout << " Введите слово для поиска: "; cin >> word; ifstream fin("infile.txt"); if (!fin) { cout << "Ошибка открытия файла." << endl; return 1; } int count = 0; while (!fin.eof()) { fin >> curword; if (equal(curword, word)) count++; } cout << "Количество вхождений слова: " << count << endl; return 0; }