Advertisement
Guest User

3

a guest
Feb 24th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. string expirationDate(string date)
  6. {
  7. int day = stoi(date.substr(0,2));
  8. int month = stoi(date.substr(3,2));
  9. int year = stoi(date.substr(6,4));
  10. string status;
  11.  
  12. if (year<2020)
  13. {
  14.   if (month>=8)
  15.   {
  16.     if (day<22) status="Not Expire";
  17.     else status="Expire";
  18.   }
  19.   else if (month<8) status="Expire";
  20. }
  21.  
  22. else if (year>=2020)
  23. status = "Not Expire";
  24.  
  25. return status ;
  26. }
  27.  
  28. int main() {
  29. string date;
  30. cin>>date;
  31. cout<<expirationDate(date);
  32. return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement