title: How to use getline in a loop c++
body: <p>I am using getline() in a loop. During the first loop everything runs okay except for the last getline(). During the second loop the first getline() seems to have been skipped. Here is the loop: </p>
  
  <pre><code>while(true)
      {
          cout &lt;&lt;endl&lt;&lt; "Enter Student's Name: ";
          getline(cin,tmp_name);
          cout &lt;&lt; "Enter Student's RegNo: ";
          getline(cin,tmp_regno);
          cout &lt;&lt; "Enter Student's marks: ";
          cin&gt;&gt;tmp_marks;
          mystudents.push_back(student(tmp_name,tmp_regno,tmp_marks));
          mystudents[no_ofStudents].getGrade();
          no_ofStudents++;
          cout&lt;&lt;endl&lt;&lt;endl&lt;&lt;"Do you wish to continue? To continue enter yes or any other key to stop: ";
          getline(cin,continue_stop);
          if (continue_stop!="yes"&amp;&amp;continue_stop!="YES")
              break;
      }
  </code></pre>