forked from dibyendu415/DibsProjects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAge_Calculator.cpp
More file actions
37 lines (33 loc) · 873 Bytes
/
Copy pathAge_Calculator.cpp
File metadata and controls
37 lines (33 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Program to check your age till date
//Hello this is Rishabh Dhara,I have made a few changes.Look into it...
#include<iostream.h>
#include<conio.h>
void main()
{
int birth_month,birth_year;
int current_month,current_year;
int ageinyear,ageinmonth;
cout<<"Age Calculator\n\n";
cout<<"\nEnter Your Birth Month(Eg:8): ";
cin>>birth_month;
cout<<"\nEnter Your Birth Year(Eg:1999): ";
cin>>birth_year;
cout<<"\nEnter The Current Month(Eg:12): ";
cin>>current_month;
cout<<"\nEnter The Current Year(Eg:2020): ";
cin>>current_year;
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 "<<ageinyear<<" Years And "<<ageinmonth<<" Months ";
getch();
}