title: how to manipulate the txt file using C++ STL HOmework
body: <p>I have a txt file that contains name, id number, mobilenumber, and location in comma separated line.
  example 
   Robby, 7890,7788992356, 123 westminister 
   tom, 8820, 77882345, 124 kingston road
  My task is to retrieve </p>
  
  <p>Look up all of an employee's information by name.
  Look up all of an employee's information by ID.
  Add the information of an employee.
  Update the information of an employee.</p>
  
  <p>SO far I have  read the file and stored the information in a vector. Code is shown below. 
  For tasks
  1)Look up all of an employee's information by name.  I will iterate in the  vector  and prints information containing the name . I will be able to do that
  2) simialry in text file I will look for id and prints information  about that.
  BUT I am clueless about point 3 &amp; 4.</p>
  
  <p>I am posting my code below</p>
  
  <pre><code>void filter_text( vector&lt;string&gt; *words, string name)    
  {    
   vector&lt;string&gt;::iterator startIt = words-&gt;begin();    
   vector&lt;string&gt;::iterator endIt = words-&gt;end();    
   if( !name.size() )        
       std::cout &lt;&lt; " no word to found for empty string ";  
  
   while( startIt != endIt)     
   {      
      string::size_type pos = 0;     
      while( (pos = (*startIt).find_first_of(name, pos) ) !=  string::npos)    
          std:cout &lt;&lt;" the name is " &lt;&lt; *startIt&lt;&lt; end;    
      startIt++;     
   }
  }     
  
  int main()               
  {             
   // to read a text file       
    std::string file_name;   
    std::cout &lt;&lt; " please enter the file name to parse" ;    
    std::cin  &gt;&gt; file_name;
  
    //open text file for input
    ifstream infile(file_name.c_str(), ios::in) ;
    if(! infile)
    {
      std::cerr &lt;&lt;" failed to open file\n";
      exit(-1);
    }
   vector&lt;string&gt; *lines_of_text = new vector&lt;string&gt;;
   string textline;
   while(getline(infile, textline, '\n'))
   {
      std::cout &lt;&lt;" line text:" &lt;&lt; textline &lt;&lt;std::endl;
      lines_of_text-&gt;push_back(textline);
   }
  filter_text( lines_of_text, "tony");
  return 0;
  }
  </code></pre>