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 38 39 40 |
#include <iostream> #include <string> #include <cstdio> #include <cstring> using namespace std; int main() { int t,kase=1; int dd,mm,YY,dd1,mm1,yy1; int y; cin>>t; while(t--) { scanf("%d/%d/%d",&dd,&mm,&YY);//current date scanf("%d/%d/%d",&dd1,&mm1,&yy1);//birth date y=YY-yy1; if(mm-mm1<0) { y--; } else if(mm==mm1) { if(dd<dd1) y--; } if(y<0) cout<<"Case #"<<kase++<<": Invalid birth date\n"; else if(y>130) cout<<"Case #"<<kase++<<": Check birth date\n"; else cout<<"Case #"<<kase++<<": "<<y<<"\n"; } return 0; } |