我把源码粘出来
#include<iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
int bYear[]={31,29,31,30,31,30,31,31,30,31,30,31};
int sYear[]={31,28,31,30,31,30,31,31,30,31,30,31};
cout<<"enter year,month,day:"<<endl;
int year,month,day;
int s1,s2,s,fact;
int i;
s1=(year-1)+((year-1)/4)-((year-1)/400);
cin>>year>>month>>day;
if(year%400&&year%4)
for(;i<=(month-1);++i)
{
cout<<endl;
s2=s2+bYear[i];
}
s2=s2+day;
if(year%400!=0&&year%4!=0)
{
for(;i<=(month-1);++i)
{
s2+=sYear[i];
}
s2=s2+day;
}
s=s1+s2;
fact=s%7;
switch(fact)
{
case 0:
cout<<"today is sunday";
break;
case 1:
cout<<"today is monday";
break;
case 2:
cout<<"today is tuseday";
break;
case 3:
cout<<"today is wednesday";
break;
case 4:
cout<<"today is thurday";
break;
case 5:
cout<<"today is friday";
break;
case 6:
cout<<"today is saturday";
break;
default:cout<<"this program has bugs.";
}
return 0;
}