#include <iostream> #include <fstream> #include<string> using namespace std; int main(){ ifstream input; ofstream output; output.open("Book1.txt",ios::app); int choice; size_t pos; size_t p; string line; string a; string id; cout<<"enter the name you want to search"<<endl; cin>>a; string replace = "hello"; size_t len = a.length(); input.open("Book1.txt",ios::out); if(input.is_open()) { while(getline(input,line)) { pos = line.find(a); if(pos!=string::npos) { line.replace(pos,len,replace); cout<<"Name://IDnumber//Account-Balance"<<" "<<line<<endl; } } } system("pause"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)