title: Why cant std::string take spaces in user input?
body: <p>Straight to the problem:</p>
  
  <p>This code,</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() {
      std::string string = "9 9";
      std::cout &lt;&lt; string;
      return 0;
  }
  </code></pre>
  
  <p>returns <code>9 9</code> as output.</p>
  
  <p>Yet, when inputting <code>9 9</code> to this code,</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main() {
      std::string string;
      std::cin &gt;&gt; string;
      std::cout &lt;&lt; string;
      return 0;
  }
  </code></pre>
  
  <p>it outputs <code>9</code>. Why does this happen?</p>
  
  <p>I guess it has to do with the space, but is there any way to avoid this? I must say space is the only valid separation between numbers.</p>