Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- string expirationDate(string date)
- {
- int day = stoi(date.substr(0,2));
- int month = stoi(date.substr(3,2));
- int year = stoi(date.substr(6,4));
- string status;
- if (year<2020)
- {
- if (month>=8)
- {
- if (day<22) status="Not Expire";
- else status="Expire";
- }
- else if (month<8) status="Expire";
- }
- else if (year>=2020)
- status = "Not Expire";
- return status ;
- }
- int main() {
- string date;
- cin>>date;
- cout<<expirationDate(date);
- return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement