Wierd behaviour of getline in C++ ? : <p>Well I know using cin we can't read multiple strings . But the behaviour of getline here in this program is hard to understand . I am not able to figure out what is issue in it . Is it I can't use cin and getline in tandem ?</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
  std::string name;
  std::cout &lt;&lt; "What is your name? ";
  std::cin&gt;&gt;name;
  std::cout &lt;&lt; "Hello, " &lt;&lt; name &lt;&lt; "!"&lt;&lt;std::endl;
  getline (std::cin, name);
  std::cout &lt;&lt; "Hello, " &lt;&lt; name &lt;&lt; "!\n";
}

Input :
Jai Simha Verma 
Jai Simha Verma

OUTPUT:
What is your name? Hello, Jai!
Hello,  Simha Verma !
</code></pre>
