From badbbf456a4c5175d17f22200b003e101c463dd3 Mon Sep 17 00:00:00 2001 From: rishabh-dhara <58063360+rishabh-dhara@users.noreply.github.com> Date: Tue, 7 Jan 2020 13:34:28 +0530 Subject: [PATCH] Update Age_Calculator.cpp --- Age_Calculator.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Age_Calculator.cpp b/Age_Calculator.cpp index 6be2102..97ce6f7 100644 --- a/Age_Calculator.cpp +++ b/Age_Calculator.cpp @@ -1,4 +1,5 @@ //Program to check your age till date +//Hello this is Rishabh Dhara,I have made a few changes.Look into it... #include @@ -19,8 +20,18 @@ cout<<"\nEnter The Current Month(Eg:12): "; cin>>current_month; cout<<"\nEnter The Current Year(Eg:2020): "; cin>>current_year; -ageinyear= ; -ageinmonth= ; +if(birth_month>=current_month) +{ +ageinyear=current_year-birth_year ; +ageinmonth=current_month-birth_month; +} +else +{ + current_month=12+current_month; + current_year=current_year-1; + ageinmonth=current_month-birth_month; + ageinyear=current_year-birth_year; +} cout<<"\n\nYour Age is "<