title: How continuous cin input works in C++
body: <p>I'm sorry but I could't find a better title for this question. I'm following Stroustrup's Programming: Principles and Practice using C++. This example code came to my attention. My question is, how does cin identify two different types in one single word like 200.40i (200.40 double and i char)? I mean, shouldn't it be expecting at least an empty-space separated input?</p>
  
  <pre><code>int main()
  {
      constexpr double cm_per_inch = 2.54;
      double length = 1;
      char unit = 0;
      cout &lt;&lt; "Please enter a length followed by a unit (c or i):\n";
      cin &gt;&gt; length &gt;&gt; unit;
      if (unit == 'i')
          cout &lt;&lt; length &lt;&lt; "in == " &lt;&lt; cm_per_inch*length &lt;&lt; "cm\n";
      else
          cout &lt;&lt; length &lt;&lt; "cm == " &lt;&lt; length/cm_per_inch &lt;&lt; "in\n";
  }
  </code></pre>
  
  <p>If i just run the program and type in: 200.40i works fine, same for:    200.40 i and for: 200.40 \n i.</p>