title: Validating a date format in c++
body: <p>I'm trying to validate a date format on on a line such as this one (01 10 2017) by creating a stream. </p>
  
  <pre><code>        if(i%5==4){ //DATE
              std::string date;
              int day;
              int month;
              int year;
              std::ostringstream oss(date);
              oss &gt;&gt; day;
              oss &gt;&gt; month;
              oss &gt;&gt; year;
              if (day &gt;=0 &amp;&amp; day &lt;= 31){
                  return true;}
              if (month &gt;=01 &amp;&amp; month &lt;= 12){
                  return true;}
              if (year &gt;=1900){
                  return true;}
          }
  </code></pre>
  
  <p>However, the code doesn't compile. What could I do to improve the validation?</p>
  
  <p>Thank you</p>