#include <iostream>
#include <fstream>
#include <string>
#include <hash_set>
using namespace std;
using namespace stdext;
int main()
{
hash_set<string> hs;
hash_set<string>::iterator it;
ofstream out1("file1.txt");
ofstream out2("file2.txt");
out1<<"www.baidu.com"<<endl;
out1<<"www.google.com"<<endl;
out1<<"www.sina.com"<<endl;
out2<<"www.baidu.com"<<endl;
out2<<"www.yahoo.com"<<endl;
ifstream in1("file1.txt");
ifstream in2("file2.txt");
string str1;
string str2;
while(getline(in2,str2))
{
hs.insert(str2);
}
while(getline(in1,str1))
{
if((it = hs.find(str1)) != hs.end ())
{
cout<<"find: "<<str1<<endl;
}
}
system("pause");
return 0;
}