#include #include using namespace std; int getInteger(string s) { int result=-1; try { result=stoi(s); } catch(invalid_argument&) { //do nothing, result is still -1 } return result; }//getInteger bool leapYear(int yr) { bool leap=false; if(yr%4==0) leap=true; if(yr%100==0 && yr%400!=0) leap=false; cout<>input; //Example: 10/31/2016 int p=input.find_first_of("/"); // Using example: p=2 if(p<0) cout<<"not a valid date\n"; else { month=getInteger(input.substr(0,p)); //Using example: month=10 input=input.substr(p+1); //Using example: input="31/2016" p=input.find_first_of("/"); //Using example: p=2 if(p<0) cout<<"not a valid date\n"; else { day=getInteger(input.substr(0,p)); //Using example: day=31 input=input.substr(p+1); //Using example: input="2016" year=getInteger(input); //Using example: year=2016 if(month<0 || month>12 || day<0 || day>31 || year<0) cout<<"not a valid date\n"; else { //We have 3 integers, it still might not be a valid date! cout<<"You entered month="<days[month]) cout<<"There are not that many days in "<