title: Can't figure out how to check if anything has been inputted
body: <p>Alright guys so I'm learning C++ using Bjarne Stroustrup's Programming Principles and Practice Using C++ book, and one of the drills asks me to</p>
  
  <p>Step one: Enter a number followed by a unit(allow cm, m, in, and ft)</p>
  
  <p>Step two: Convert that number into meters and output it</p>
  
  <p>Step three: Reject any unit that the program doesn't know how to convert</p>
  
  <p>Step four: Reject any values without units</p>
  
  <p>Here is what I have so far:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;algorithm&gt;
  #include &lt;cmath&gt;
  
  using namespace std;
  
  inline void keep_window_open() { char ch; cin&gt;&gt;ch; }
  
  int main()
  {
      constexpr double cm_to_m = 100;
      constexpr double cm_to_in = 2.54;
      constexpr double in_to_ft = 12;
  
      double i, in_meters;
      string unit;
  
      while (cin &gt;&gt; i)
      {
          cin &gt;&gt; unit;
          if(unit == "cm" || unit == " cm") {in_meters = i / cm_to_m; cout &lt;&lt; "That is " &lt;&lt; in_meters &lt;&lt; "m" &lt;&lt; endl;}
          else if(unit == "in" || unit == " in") {in_meters = i * cm_to_in / cm_to_m; cout &lt;&lt; "That is " &lt;&lt; in_meters &lt;&lt; "m" &lt;&lt; endl;}
          else if(unit == "ft" || unit == " ft") {in_meters = (i * in_to_ft) * cm_to_in / cm_to_m; cout &lt;&lt; "That is " &lt;&lt; in_meters &lt;&lt; "m" &lt;&lt; endl;}
          else if(unit == "m" || unit == " m") {cout &lt;&lt; "That is " &lt;&lt; i &lt;&lt; "m" &lt;&lt; endl;}
          else if() cout &lt;&lt; "You need to enter a unit after the number(cm, m, in, ft)" &lt;&lt; endl;
          else cout &lt;&lt; "I don't know that unit" &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>My problem is at step four. I cannot, for the life of me, figure out how to check if no unit has been entered after the number. I've tried if(unit == " "), and everything similar to that, but when I just type in a number, it continues until I type in a unit.</p>
  
  <p>If you guys can help with just giving hints so I can figure it out myself, that would be helpful :)</p>
  
  <p>TIA</p>