Answer:
#include <iostream>
#include <fstream>
using namespace std;
void replace(ifstream&,ofstream&);
int main()
{char filename[30];
bool found=false;
cout<<"what is the name of the input file youare using? ";
cin>>filename;
ifstream input;
ofstream output;
input.open(filename);
if(input.fail())
{ cout<<"file did notopen please check it\n";
system("pause");
return 1;
}
cout<<"what is the name of theoutput file you are using? ";
cin>>filename;
cin.ignore(100,'\n');
output.open(filename);
replace(input,output);
input.close();
output.close();
system("pause");
return 0;
}
void replace(ifstream& in,ofstream& out)
{bool found=false;
string lookfor="#N#";
string data,name;
int n;
getline(in,data);
while(in)
{if(!found)
{n=data.find(lookfor,0);
if(n!=-1)
{found=true;
cout<<"Enter name: ";
getline(cin,name);
data.replace(n,3,name);
}
}
out<<data<<endlu;
getline(in,data);
}
}