title: C++ cin.ignore and getline in while loop
body: <p>I'm very new to programming, and I'm having trouble using getline in a while loop. When I cout the course variable the first letter is missing. Getting rid of cin.ignore sends it into an infinite loop. </p>
  
  <p>Here's what I have so far:  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  int main (){
     string answer = "Yes";
     string course;
  
     while (answer == "Yes"){
        cin.ignore();
        cout&lt;&lt; "Enter a course name: ";
        getline (cin, course);
        cout&lt;&lt; course &lt;&lt; endl;
  
        cout&lt;&lt; "Continue ('Yes' or 'No')? ";
        cin&gt;&gt; answer;
        cout&lt;&lt; answer &lt;&lt; endl;
     }
  
     return 0;
  }
  </code></pre>