title: Cin is skipped in the second iteration of while loop
body: <p>Hey guys I have been working on fixing this problem for like three hours and nothing seems to work. When the program runs and i enter in Jay's number to get to the admin menu which all works fine except for the Add Employee option. When i select it it runs fine the first time and then one the employee is created the admin menu with all the options pops up and flashes every few seconds like its refreshing. In the current state i have a bunch of ignores after all the cin statements because everyone online says it has to do with the user pushing enter after giving an input and then that being read on the next iteration, but to be honest i was just guessing around. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;windows.h&gt;
  #include &lt;conio.h&gt;
  #include &lt;stdio.h&gt;
  
  
  using namespace std;
  bool AdminMenu(int id);
  int EmployeeMenu(int id);
  void printInfo(int id);
  int findEmptySpot();
  void createNewEmployee(int x);
  struct employee{
  
      string name;
      bool adminStatus;
      int id;
  };
  typedef struct employee Employee;
  Employee data[100];
  int main()
  {
      bool x = true;
  
      while(x)
      {
  
  
          int input,i=0;
  
          data[0] = {"Joshua",false,5656};
          data[1] = {"Jay",true,1982};
          cout&lt;&lt; "Enter your 4 digit id: ";
          cin&gt;&gt; input;
          cin.ignore();
  
  
          std::system("cls");
          while(data[i].id!=input)
              i++;
              ;
          if(data[i].adminStatus ==true)
              x = AdminMenu(i);
          else
              EmployeeMenu(i);
  
      }
      return 0;
  }
  bool AdminMenu(int placeInArray)
  {
      while(true)
      {
          cin.ignore();
          int input=0;
          cout&lt;&lt;"You are in the admin menu\n1. Print My info\n2. Add Employee\n8. Close Program\n9. Finish"&lt;&lt;endl;
          cin&gt;&gt; input;
  
  
  
  
  
  
  
          if(input&lt;1||input&gt;9)
          {
              cout&lt;&lt; "Invalid input please try again"&lt;&lt;endl;
              Sleep(1000);
              std::system("cls");
          }
          else if(input==1)
          {
              std::system("cls");
              printInfo(placeInArray);
              getch();
              std::system("cls");
          }
          else if(input ==2)
          {
              int newPlace = findEmptySpot();
              cin.ignore();
              cout&lt;&lt;" Enter the employee's name";
              cin &gt;&gt; data[newPlace].name;
              cin.ignore();
              cout&lt;&lt;" Enter the employee's ID";
              cin &gt;&gt; data[newPlace].id;
              cin.ignore();
              cout&lt;&lt;" Enter the employee's admin status";
              cin &gt;&gt; data[newPlace].adminStatus;
  
  
              std::system("cls");
              cout&lt;&lt; "Sweet your new employee profile has been created!";
              printInfo(newPlace);
  
          }
          else if(input ==8)
          {
              std::system("cls");
              return false;
  
          }
          else if(input ==9)
          {
              std::system("cls");
              return true;
          }
      }
  
  
  
  }
  int EmployeeMenu(int placeInArray)
  {
      int input;
      while(true)
      {
  
          cout&lt;&lt; "You are in the Employee Menu\n1. Print My info\n9. Finish";
          cin&gt;&gt; input;
          std::system("cls");
          if(input&lt;1||input&gt;9)
          {
              cout&lt;&lt; "Invalid input please try again"&lt;&lt;endl;
              Sleep(1000);
              std::system("cls");
          }
          else if(input==1)
              printInfo(placeInArray);
          else if(input ==9)
          {
              std::system("cls");
              return 0;
          }
      }
  
  
  }
  void printInfo(int placeInArray)
  {
  
      cout&lt;&lt;"Name: "&lt;&lt;data[placeInArray].name&lt;&lt;endl;
      cout&lt;&lt;"ID: "&lt;&lt;data[placeInArray].id&lt;&lt;endl;
      cout&lt;&lt;"Admin status: "&lt;&lt; data[placeInArray].adminStatus&lt;&lt;""&lt;&lt;endl;
  }
  int findEmptySpot()
  {
       int i=0;
       while(data[i].id!=0)
              i++;
       return i;
  }
  void createNewEmployee(int x)
  {
  
  
  
  }
  </code></pre>
  
  <p>Anyways any information about where i need to use cin.clear() and cin.ignore() would be appreciated!</p>