#include<iostream>#include<string>#include<fstream>using namespace std;
void main(){ ifstream in("e://test.txt"); string word; int num = 0; while(in>>word) { if(word=="hello") { num++; } } cout<<"hello 出现的次数为:"<<num<<endl;}