title: Reading Different Input Types C++
body: <p>I am attempting to create a student object which takes the name, id, email, and three grades which are integers. </p>
  
  <p>My code is quite simple and is as follows:</p>
  
  <pre><code>studentObj* newStudent = new studentObj;
  
  cout &lt;&lt; "Student First Name: ";
  getline(cin, newStudent-&gt;name);
  cout &lt;&lt; "Student ID: ";
  getline(cin, newStudent-&gt;id);
  cout &lt;&lt; "Student Email: ";
  getline(cin, newStudent-&gt;email);
  cout &lt;&lt; "Grade 1: ";
  cin &gt;&gt; newStudent-&gt;gradeOne;
  cout &lt;&lt; "Grade 2: ";
  cin &gt;&gt; newStudent-&gt;gradeTwo;
  cout &lt;&lt; "Term Grade: ";
  cin &gt;&gt; newStudent-&gt;termGrade;
  
  cout &lt;&lt; "Student Name: " + newStudent-&gt;name &lt;&lt; endl;
  cout &lt;&lt; "Student ID: " + newStudent-&gt;id &lt;&lt; endl;
  cout &lt;&lt; "Student Email: " + newStudent-&gt;email &lt;&lt; endl;
  cout &lt;&lt; "Grade 1: " + newStudent-&gt;gradeOne &lt;&lt; endl;
  cout &lt;&lt; "Grade 2: " + newStudent-&gt;gradeTwo &lt;&lt; endl;
  </code></pre>
  
  <p>I assumed this would run flawlessly, but unfortunately that is not the case. It seems to be an issue mixing the <code>getline()</code> and <code>cin</code>.</p>
  
  <p>The output is:</p>
  
  <pre><code>Student Name: Test Tester
  Student ID: abcdef
  Student Email: email@test.com
  rade 1:
  ade 2:
  m Grade: 
  </code></pre>
  
  <p>I've tried adding <code>cin.ignore(numeric_limits&lt;streamsize&gt;::max(),'\n');</code> in a few places, but no luck. Any suggestions?
  `</p>