#include #include #include using namespace std; int main() { string filechoice; cout << "Enter file to search: "; cin >> filechoice; ifstream in("temp.cpp"); // ifstream in(filechoice); string wordchoice; cout << "Enter word to search for: "; cin >> wordchoice; string word; int i = 0; while(in >> word) if (word == wordchoice) i++; cout << "There are " << i << " occurances of " << wordchoice << " in " << filechoice << "." << endl; }