主要是各块功能分好,解题就很简单了,一个一个功能做

#include<cstdio>
#include<iostream>
#include<string>

using namespace std;


int daytable[2][13]={
    {0,31,28,31,30,31,30,31,31,30,31,30,31},	//平年 
    {0,31,29,31,30,31,30,31,31,30,31,30,31}		//闰年 
};
 
string months[13]={" ","January","February","March","April","May","June","July","August","September","October","November","December"};	//字符串数组这样设定用string 
 
string week[8]={"","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};

bool IsLeapYear(int year){		//判断闰年 
	return (year % 100 != 0 && year % 4 == 0) || (year % 400 == 0); //(闰年是被4整除&&不被100整除)|| 被400整除 
} 
int YearDay(int year){		//每年多少天 
	if(IsLeapYear(year)){
		return 366;
	}else{
		return 365;
	}
}
int BYearDay(int year){	//0001年到今年前过多少天 ,这里别错了,我我之前以为从1000开始所以就错了!! 
	int number = 0;
	for(int i = 1; i < year; ++i){
		number += YearDay(i);
	} 
	return number;
} 
int ThisYearDay(int year, int month,int day){		//今年过多少天 
	int number = 0;
	int row = IsLeapYear(year);
	for(int i = 0; i < month; ++i){
		number += daytable[row][i];
	}
	number += day;
	return number;
} 
int main(){
	int year, day, month, numberweek;
	string emonth;
//	while(scanf("%d %s %d", &day, &emonth, &year) != EOF){
	while(cin>>day>>emonth>>year){
		for (int i = 0; i < 13; ++i){//转化成正确月份数字 
			if(months[i] == emonth){
				month = i;
				break;
			}
		}
		int  number1, number2;
		number1 = BYearDay(year);
		number2 = ThisYearDay(year, month, day);
		numberweek = (number1 + number2) % 7;
		if(numberweek != 0){		//这里注意0 ,就是周日!!!所以要区别对待 
			cout<<week[numberweek]<<endl;	//注意输出!!printf不能输出字符串数组。怪不得,我就说怎么编译错误 
		}else{
			cout<<week[7]<<endl;
		}
		
		
	}
	return 0;
}