#include <iostream>

#include <fstream>

#include <string>

#include <sstream>

#include <algorithm>

#include <iterator>



using namespace std;


int main()

{

string matchString;

cout<<"enter the name you want to find"<<endl;

cin>>matchString;

ifstream infile;

ofstream outfile;

infile.open("in.txt");

outfile.open("out.txt");

string line;

while( getline(infile,line) )

{ istringstream iss(line);

string str;

iss>>str;


if(str != matchString)

outfile<<line<<endl;

else

{

cout<<"Found "<<matchString<<endl;

}

}

}

자주애용해주세요