Advertisement
Saleh127

Untitled

Apr 29th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. int main()
  5. {
  6. string x;
  7. char c,e;
  8. ll t,a,b,d,d1,f,i,j,k,l,m,m1,y,y1;
  9. cin>>t;
  10. for(i=1; i<=t; i++)
  11. {
  12. getline(cin,x);
  13. scanf("%lld%c%lld%c%lld",&d,&c,&m,&e,&y);
  14. scanf("%lld%c%lld%c%lld",&d1,&c,&m1,&e,&y1);
  15. a=y-y1;
  16.  
  17. if(m==m1 && d<d1) a=a-1;
  18. else if(m<m1) a=a-1;
  19.  
  20. if(a<0)
  21. printf("Case #%lld: Invalid birth date\n",i);
  22. else if(a>130)
  23. printf("Case #%lld: Check birth date\n",i);
  24. else
  25. printf("Case #%lld: %lld\n",i,a);
  26. }
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement