title: std::cin:: and why a newline remains
body: <p>Reference <a href="https://stackoverflow.com/questions/6398229/why-is-the-console-closing-after-ive-included-cin-get/6398242#6398242">Why is the Console Closing after I've included cin.get()?</a></p>
  
  <p>I was utilizing <code>std::cin.get()</code></p>
  
  <pre><code>#include&lt;iostream&gt;    
  
  char decision = ' ';
  bool wrong = true;
  
  while (wrong) {
      std::cout &lt;&lt; "\n(I)nteractive or (B)atch Session?: ";
  
      if(std::cin) {
          decision = std::cin.get();
  
          if(std::cin.eof())
              throw CustomException("Error occurred while reading input\n");
      } else {
          throw CustomException("Error occurred while reading input\n");
      }
  
     decision = std::tolower(decision);
     if (decision != 'i' &amp;&amp; decision != 'b')
          std::cout &lt;&lt; "\nPlease enter an 'I' or 'B'\n";
     else
          wrong = false;
  }
  </code></pre>
  
  <p>I read <a href="http://en.cppreference.com/w/cpp/io/basic_istream/sentry" rel="noreferrer">basic_istream::sentry</a> and <a href="http://en.cppreference.com/w/cpp/io/basic_istream/get" rel="noreferrer">std::cin::get</a>.</p>
  
  <p>I chose instead to use <code>std::getline</code> as the while loop is executing twice because the stream is not empty.</p>
  
  <pre><code>std::string line; std::getline(std::cin, line);
  </code></pre>
  
  <p>As the reference I posted above states within one of the answers, <code>std::cin</code> is utilized to read a character and <code>std::cin::get</code> is utilized to remove the newline <code>\n</code>.</p>
  
  <pre><code>char x; std::cin &gt;&gt; x; std::cin.get();
  </code></pre>
  
  <p>My question is why does <code>std::cin</code> leave a newline <code>\n</code> on the stream?</p>