Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main ()
- {
- int D1;
- int D2;
- int D3;
- int M1;
- int M2;
- int M3;
- int Y1;
- int Y2;
- int Y3;
- int G;
- int L=0;
- int Valid=1;
- cout<<"Age Calculator\n";
- do
- {
- cout<<"\n Enter the date of the birth (DD MM YYYY): ";
- cin>> D1;
- cin>> M1;
- cin>> Y1;
- if (M1==1 || M1==3 || M1==5 || M1==7 || M1==9 || M1==11)
- int L=31;
- if (M1==4 || M1==6 || M1==8 || M1==10 || M1==12)
- int L=30;
- if (M1==2)
- int L=29;
- if (D1<1 || D1>L)
- {
- cout<<"InValid Date. Enter Again"<<endl;
- int Valid=0;
- }
- else if (M1<1 || M1>12)
- {
- cout<<"InValid Date. Enter Again"<<endl;
- int Valid=0;
- }
- else if (Y1<0 || Y1>2011)
- {
- cout<<"InValid Date. Enter Again"<<endl;
- int Valid=0;
- }
- } while (Valid=0);
- cout<<"\n Enter second day of the month (01-31): ";
- cin>> D2;
- cout<<"\n Enter second month: ";
- cin>> M2;
- cout<<"\n Enter the second year: ";
- cin>> Y2;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement