C++ Program to Find Your Current Age (Age Calculator In C++)

 #include<iostream>

using namespace std;

int main()

{

int m1,d1,y1,d2,m2,y2,dd,mm,yyyy;

cout<<"======================================================\n";

cout<<"    AGE CALCULATOR | MULTIPLE IF & LOGICAL AND\n";

cout<<"======================================================\n";

cout<<"Enter Current Day (DD)         : ";

cin>>d1;

cout<<"Enter Current month (MM)         : ";

cin>>m1;

cout<<"Enter Current year  (YYYY)       : ";

cin>>y1;

cout<<endl;

cout<<"Enter Your Birth Day (DD)       : ";

cin>>d2;

cout<<"Enter your Birth Month (MM)      : ";

cin>>m2;

cout<<"Enter your Birth Year (YY)       : ";

cin>>y2;

if (d2>d1 && d2<30 && d1<30)

{   d1+=30;

m1-=1; }

if(m2>m1 && m1<12 && m2<12)

{ m1+=12;

y1-=1; }   

dd=d1-d2;

mm=m1-m2;

yyyy=y1-y2;

cout<<"\nYour Age Is "<<yyyy<< " Years , "<<mm<<" months & "

<<dd<<" Days\n";

cout<<"======================================================\n";

return 0;

}

Comments

Popular posts from this blog