Age calculator

PHOTO EMBED

Wed May 24 2023 03:16:15 GMT+0000 (Coordinated Universal Time)

Saved by @Vednikol #c++

#include <iostream>
#include <string>
using namespace std;

int main()

{
     int yearnow;
     int monthnow;
     int yearborn;
     int monthborn;
     int daynow;
     int dayborn;
     

     
     cout << "Enter the current year: ";
     cin >> yearnow;
     cout << "Enter the current month: ";
     cin >> monthnow;
     cout << "Enter the current day: ";
     cin >> daynow;
     cout << "Enter the year when you were born: ";
     cin >> yearborn;
     cout << "Enter the month when you were born: ";
     cin >> monthborn;
     cout << "Enter the day when you were born: ";
     cin >> dayborn;
     
     int yearactual = yearnow - yearborn;
     
     if (monthborn > monthnow){
             
             cout << "You are " << yearactual - 1 << " years old\n";
             cout << "You are " << 12 - (monthborn - monthnow) - 1 << " months old\n";
             cout << "And " << daynow << " days old";
         
     }
     if (monthborn < monthnow){
         if (daynow > dayborn){
             
             cout << "You are " << yearactual << " years old\n";
             cout << "You are " << monthnow - monthborn << " months old\n";
             cout << "And " << daynow - dayborn << " days old";
             
         }
         if (daynow < dayborn){
             
              cout << "You are " << yearactual << " years old\n";
             cout << "You are " << monthnow - monthborn - 1<< " months old\n";
             cout << "And " << daynow << " days old";
             
         }
         if (daynow == dayborn){
             
              cout << "You are " << yearactual << " years old\n";
             cout << "You are " << monthnow - monthborn << " months old\n";
             cout << "And " << "0" << " days old";
             
         }
         
     }
      if (monthborn == monthnow){
         cout << "You are " << yearactual << " years old\n";
         cout << "You are " << "0" << " months old\n";
         cout << "And " << daynow << " days old";
     }
     
     
     
     return 0;
}
content_copyCOPY

Very nice, made this code myself
https://vednikol-sturdy-palm-tree-445qgv4qx6g3q95.github.dev/