title: How to compare day/month/year in C or C++?
body: <p>I have a program that asks the user to input to dates then it displays which one is more recent I've done it like this </p>
  
  <pre><code>if (year1&gt;year2 || month1&gt;month2 || day1&gt;day2)
      return -1;
  
  if (year1&lt;year2 || month1&lt;month2 || day1&lt;day2)
      return +1;
  </code></pre>
  
  <p>but the output is not quite correct.</p>