#include <iostream>
using namespace std;
int main(){
int month,day,year;
char symbol;
do{
cout<<"Enter date: ";
cin>>month>>symbol>>day>>symbol>>year;
cin.clear();
cin.ignore(10000,'\n'); // Or better:
// std::numeric_limits<std::streamsize>::max()
// instead of just 10000
if(symbol=='/'&&month<=05&&day<=31&&year==2016){
cout<<month<<symbol<<day<<symbol<<year;
if(month==01){ // this code is for month of January
if(day==3||day==10||day==17||day==24||day==31){
cout<<" is Sunday.";
}
else if(day==4||day==11||day==18||day==25){
cout<<" is Monday.";
}
else if(day==5||day==12||day==19||day==26){
cout<<" is Tuesday.";
}
else if(day==6||day==13||day==20||day==27){
cout<<" is Wednesday.";
}
else if(day==7||day==14||day==21||day==28){
cout<<" is Thursday.";
}
else if(day==1||day==8||day==15||day==22||day==29){
cout<<" is Friday.";
}
else if(day==2||day==9||day==16||day==23||day==30){
cout<<" is Saturday.";
}
}
else if(month==02){ //this code is for month of February
if(day==7||day==14||day==21||day==28){
cout<<" is Sunday.";
}
else if(day==1||day==8||day==15||day==22||day==29){
cout<<" is Monday.";
}
else if(day==2||day==9||day==16||day==23){
cout<<" is Tuesday.";
}
else if(day==3||day==10||day==17||day==24){
cout<<" is Wednesday.";
}
else if(day==4||day==11||day==18||day==25){
cout<<" is Thursday.";
}
else if(day==5||day==12||day==19||day==26){
cout<<" is Friday.";
}
else if(day==6||day==13||day==20||day==27){
cout<<" is Saturday.";
}
}
else if(month==03){ //this code is for month of March
if(day==6||day==13||day==20||day==27){
cout<<" is Sunday.";
}
else if(day==7||day==14||day==21||day==28){
cout<<" is Monday.";
}
else if(day==1||day==18||day==15||day==22||day==29){
cout<<" is Tuesday.";
}
else if(day==2||day==9||day==16||day==23||day==30){
cout<<" is Wednesday.";
}
else if(day==3||day==10||day==17||day==24||day==31){
cout<<" is Thursday.";
}
else if(day==4||day==11||day==18||day==25){
cout<<" is Friday.";
}
else if(day==5||day==12||day==19||day==26){
cout<<" is Saturday.";
}
}
else if(month==04){ //this code is for month of April
if(day==3||day==10||day==17||day==24){
cout<<" is Sunday.";
}
else if(day==4||day==11||day==18||day==25){
cout<<" is Monday.";
}
else if(day==5||day==12||day==19||day==26){
cout<<" is Tuesday.";
}
else if(day==6||day==13||day==20||day==27){
cout<<" is Wednesday.";
}
else if(day==7||day==14||day==21||day==28){
cout<<" is Thursday.";
}
else if(day==1||day==8||day==15||day==22||day==29){
cout<<" is Friday.";
}
else if(day==2||day==9||day==16||day==23||day==30){
cout<<" is Saturday.";
}
}
else if(month==05){ //this code is for month of May
if(day==1||day==8||day==15|day==22||day==29){
cout<<" is Sunday.";
}
else if(day==2||day==9||day==16||day==23||day==30){
cout<<" is Monday.";
}
else if(day==3||day==10||day==17||day==24||day==31){
cout<<" is Tuesday.";
}
else if(day==4||day==11||day==18||day==25){
cout<<" is Wednesday.";
}
else if(day==5||day==12||day==19||day==26){
cout<<" is Thursday.";
}
else if(day==6||day==13||day==20||day==27){
cout<<" is Friday.";
}
else if(day==7||day==14||day==21||day==28){
cout<<" is Saturday.";
}
}
break;
}
else{
cout<<"You have entered an invalid input.\n"<<endl;
}
}while(symbol!='/'||!(month<=05)||!(day<=31)||year!=2016);
return 0;
}