#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <iterator>
#include <algorithm>

using namespace std;

int main() {
    cout<<"Enter a word to be searched in the file words.txt:";
    string wordForQuery;
    cin>>wordForQuery;
    // no files on ideone.com, using string
    string inFile_contents = "there are some words in this file\nthat can be searched";
    istringstream inFile(inFile_contents);
    // ifstream inFile("words.txt"); 
    istream_iterator<string> beg(inFile), end;
    if(find(beg, end, wordForQuery) != end)
        cout << "Found!\n";
    else
        cout << "Not Found!\n";
}