title: Trying to use int in getline
body: <pre><code>cout &lt;&lt; "How many questions are there going to be on this exam?" &lt;&lt; endl;
  cout &lt;&lt; "&gt;&gt;";
  getline(cin, totalquestions);
  </code></pre>
  
  <p>This small piece of code comes from a function in a class that I have created and I need <code>totalquestions</code> to be an int so that it can run through a for loop and keep asking the total amount of questions that I have asked.</p>
  
  <pre><code>question q;
  for(int i = 0; i &lt; totalquestions; i++)
  {
      q.inputdata();
      questions.push_back(q);
  }
  </code></pre>
  
  <p>Where does this piece of code comes to play?  Does anyone have any idea to make this work?</p>