#include<iostream> using namespace std; int main() { int y,m,d,temp; int a[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int TotalDay=365; int sum=0,sum1=0,sum2=0; cout<<"if 2007.1.1 is Monday,please input a date,i can figure out what day it is:"<<endl; cin>>y>>m>>d; for(int i=2007;i<y;i++) { if((i%4==0)&&(i%100!=0)||(i%400==0)) { TotalDay+=1; } sum1+=TotalDay; } if((y%4==0)&&(y%100!=0)||(y%400==0)) { a[2]+=1; for(int i=1;i<m;i++) { sum2+=a[i]; } sum=sum1+sum2+d; }else { for(int j=1;j<m;j++) { sum2+=a[j]; } sum=sum1+sum2+d; } temp=sum%7; switch(temp) { case 0 : cout<<"Monday";break; case 1 : cout<<"Tuesday";break; case 2 : cout<<"Wednesday";break; case 3 : cout<<"Thursday";break; case 4 : cout<<"Friday";break; case 5 : cout<<"Saturday";break; case 6 : cout<<"Sunday";break; default : break; } return 0; }