title: comparing user input with text file
body: <p>I doing C++ . I want to compare what is entered by the user in the whole texfile.<br>
  My textfile is something like this:</p>
  
  <blockquote>
    <p>Kumar India   +9102223403434   01/02/1980  SingaporeAirlines 8118 Elite   -</p>
  </blockquote>
  
  <p>I have a total of 15 data items. 
  And on top of it, the user only has 3 tries if they fail to input the right data. </p>
  
  <p>This is my code. Please advice. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;iomanip&gt;
  #include &lt;fstream&gt;
  void Member();
  using namespace std;
  
  int main()
  {
      int option;
      string member;
      cout&lt;&lt;"\tWelcome!\n";
      cout&lt;&lt;"\n1. Member"&lt;&lt;endl;
      cout&lt;&lt;"2. Non member"&lt;&lt;endl;
      cout&lt;&lt;"Please enter your option."&lt;&lt;endl;
      cin&gt;&gt;option;
      system("cls");
      {
      if (option==1)
      {
          Member();
      }
      else if (option==2)
      {
      cout&lt;&lt;"awesome";
      }
      else
          cout&lt;&lt;"Invalid choice!";
      }
      system("pause");
      return 0;
  }
  
  void Member()
  {
  ifstream inFile;
  string userName,userNationality,airline,userType,type,userBirthday,birthday,userContact,Tmiles,userBenefit; 
  bool found=false;
  for (int i=0; i&lt;3; i++)
  {
  cout &lt;&lt; "Enter birthday: ";
  cin&gt;&gt;birthday;
  inFile.open("list.txt");
  if (!inFile)
  cout &lt;&lt; "Unable to open file"&lt;&lt;endl;
  else
  {
  while (!inFile.eof())
  {
      inFile &gt;&gt; userName &gt;&gt; userNationality &gt;&gt; userContact &gt;&gt; userBirthday &gt;&gt; airline &gt;&gt; Tmiles &gt;&gt; userType &gt;&gt; userBenefit;
  if (inFile.fail())
      break;
  else if (userBirthday == birthday)
          {
          system("cls");
          cout&lt;&lt;"welcome"&lt;&lt; " " &lt;&lt; userName &lt;&lt;"!" &lt;&lt; endl;
          found=true;
          break;
          }   
  }
  }
      }
  inFile.close();
      if (!found) //found==false
          cout&lt;&lt;"You have exceed the limit. PLease try again"&lt;&lt;endl;
  }
  </code></pre>