title: Writing 2 names (with spaces) in C++ (cin command)
body: <p>I am beginner to the C++ and was trying to build first codes. Right now I'm trying to learn cin command but there is a problem. When I use this code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int main() {
      string name;
      string surname;
      cout&lt;&lt;&quot;Please enter your name: &quot;;
      cin&gt;&gt;name;
      cout&lt;&lt;&quot;Please enter your surname: &quot;;
      cin&gt;&gt;surname;
      cout&lt;&lt;&quot;Your name: &quot;&lt;&lt;name &lt;&lt;endl;
      cout&lt;&lt;&quot;Your surname: &quot;&lt;&lt;surname;
  }
  </code></pre>
  <p>The output is:</p>
  <pre><code>Please enter your name: aaa bbb
  Please enter your surname: Your name: aaa
  Your surname: bbb
  </code></pre>
  <p>So when I use 2 names in the 'name' variable, this happens. But when I just write 'aaa' in the name and 'bbb' in the surname, it works perfectly fine:</p>
  <pre><code>Please enter your name: aaa
  Please enter your surname: bbb
  Your name: aaa
  Your surname: bbb
  </code></pre>
  <p>What do I have to do? Thanks.</p>