title: Check if a spelled number is in a range in C++
body: <p>I want to check the (numeric) input against a list of ranges (min,max) while the input is partially typed in; in other words, I need an elegant algorithm to check the prefix of a number against a range (without using regular expressions).</p>
  
  <p>Sample testcases:</p>
  
  <pre><code> 1 is in (  5,   9) -&gt; false
   6 is in (  5,   9) -&gt; true
   1 is in (  5,  11) -&gt; true  (as 10 and 11 are in the range)
   1 is in (  5, 200) -&gt; true  (as e.g. 12 and 135 are in the range)
  11 is in (  5,  12) -&gt; true
  13 is in (  5,  12) -&gt; false 
  13 is in (  5,  22) -&gt; true
  13 is in (  5, 200) -&gt; true  (as 130 is in the range)
   2 is in (100, 300) -&gt; true  (as 200 is in the range)
  </code></pre>
  
  <p>Do you have any idea?</p>