title: What's the difference between getline and std::istream::operator>>()?
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  int main()
  {
     string username;
     cout&lt;&lt; "username" ;
     cin &gt;&gt; username; 
  }
  </code></pre>
  
  <p>So I was curious on what's the difference between these two codes, I heard it's the same thing but if it is then why two ways of doing it then? </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main()
  {  
     string username;
     cout &lt;&lt; "username" ;
     getline (cin,username) ;
  }
  </code></pre>