title: C++ compare dates to get age
body: <p>Hello I am new to C++ expecialy dates in C++.. how can I compare these numbers 29(day) 08(month) 86(year) with todays date to get age ?</p>
  
  <p>Here is hwo I started my function:</p>
  
  <pre><code>std::string CodeP, day, month, year, age;
  
  std::cout&lt;&lt;"Enter Permanent Code(example: SALA86082914) :\n "; //birthday first six numbers in code
  
  std::cin&gt;&gt;CodeP;
  
  year  = CodeP.substr (4,2);
  month = CodeP.substr (6,2);
  day = CodeP.substr (8,2);
  
  std::cout&lt;&lt;"day :"&lt;&lt;day &lt;&lt;'\n';
  std::cout&lt;&lt;"month :"&lt;&lt;month &lt;&lt;'\n';
  std::cout&lt;&lt;"year :"&lt;&lt;year &lt;&lt;'\n';
  
  //then get today's date to compare with the numbers of birthday to get age
  </code></pre>