#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
string word,word_1,word_2;
fstream iofile("d:\\a.txt",ios_base::in|ios_base::out);
  if(!iofile)
    {
     cerr<<"error:unable to open !"<<endl;
    // return -1;
    }
cout<<"input a word you want to change"<<endl;
cin>>word_1;
cout<<"input a word you want to change to"<<endl;
cin>>word_2;
while(iofile>>word)
{
  if(word==word_1)//替换不成,要用指针吗?
  iofile<<word_2;
}
}