#include #include using namespace std; unsigned ilosc_slow(string wpis_slowo, ifstream& hamlet) { unsigned i=0; string slowa; while(hamlet >> slowa) { if (wpis_slowo == slowa) { i++; } } hamlet.close(); return i; } int main() { string wpis_slowo; cout << "Podaj szukane slowo: " << endl; cin >> wpis_slowo; ifstream plik; plik.open("hamlet.txt"); if(plik.good()) { cout << ilosc_slow(wpis_slowo, plik) << endl; plik.close(); } return 0; }