title: How to search array of structs for a string(name) and return info for that string(name)?
body: <p>With this program, when i type in a name nothing is returned.</p>
  
  <p>How would I fix this?</p>
  
  <p>There are 1000 lines of info that looks like this:</p>
  
  <blockquote>
    <p>114680858 19670607 Matilda Vincent MI </p>
    
    <p>114930037 19471024 Desdemona Hanover ID </p>
    
    <p>115550206 19790110 Xanadu Perlman ND </p>
    
    <p>116520629 19630921 Alexander Hall SD </p>
    
    <p>117050976 19301016 David Lamprey GA </p>
    
    <p>119610646 19650202 Thomas Porlock IL </p>
    
    <p>120330928 19621126 Cary Cartman NC</p>
    
    <p>etc......</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>struct employees
  {
      int ss_number;//social security
      int dob;//date of birth YYYY/MM/DD Ex.) 19870314=1987/03/14
      string f_name;
      string l_name;
      string state; //state of residence
  };
  
  void read_file()//read file into array of 1000 structs
  {
      ifstream data("/home/www/class/een118/labs/database1.txt");
      employees array[1000]
      if(!data.fail())
      {
          int i;
          for(int i=0;i&lt;1000;i++)
          {
              data&gt;&gt;array[i].ss_number
                  &gt;&gt;array[i].dob
                  &gt;&gt;array[i].f_name
                  &gt;&gt;array[i].l_name
                  &gt;&gt;array[i].state;
          }
          for(int i=0;i&lt;1000;i++)
          {
              cout&lt;&lt;array[i].ss_number&gt;&gt;" "&lt;&lt;array[i].dob&gt;&gt;" "&lt;&lt;array[i].f_name&gt;&gt;" "&lt;&lt;
              array[i].l_name&gt;&gt;" "&lt;&lt;array[i].state;
          }
      }
  }
  
  void print_person(employees e)
  {
      cout&lt;&lt;e.ss_number&gt;&gt;" "&lt;&lt;e.dob&gt;&gt;" "&lt;&lt;e.f_name&gt;&gt;" "&lt;&lt;e.l_name&gt;&gt;" "&lt;&lt;e.state;
  }
  
  void search(employees array[])//type in name and get that persons ss_number,dob etc...
  {
      string first;
      string last;
      cout&lt;&lt;"Enter name";
      cin&gt;&gt;first&gt;&gt;last;
      for(int i=0;i&lt;1000;i++)
      {
          if(array[i].f_name==first &amp;&amp; array[i].l_name==last)
          {
              print_person(array[i]);
          }
      }
  }
  
  void main()
  {
      employees array[10];
      read_file();
      search(array);
  }
  //  ...
  </code></pre>