#include
int main()
{
int i,month,day,d=0,a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
scanf("%d月%d日",&month,&day);
for(i=0;id+=a[i];d+=day;
switch(d%8)
{
case 1:case 2:case 3:printf("英语");break;
case 4:case 5:case 6:printf("数学");break;
default:printf("政治");
}
return 0;
}
//运行示例:
#include
#include
int main(int argc, char *argv[])
{
struct tm info = {0};
time_t base_sec = 0;
time_t now_sec = 0;
int year = 0, mon = 0, day = 0;
int days = 0;
info.tm_year = 2019 - 1900;//2019年
info.tm_mon = 0;//1月
info.tm_mday = 1;//1日
base_sec = mktime(&info);
printf("请输入年份:\n");
scanf("%d", &year);
if (year < 2019)
{
printf("年份日期过小\n");
return 0;
}
printf("请输入月份:\n");
scanf("%d", &mon);
printf("请输入月份中的日期:\n");
scanf("%d", &day);
info.tm_year = year - 1900;
info.tm_mon = mon-1;
info.tm_mday = day;
now_sec = mktime(&info);
days = (now_sec-base_sec)/60/60/24;
days %= 8;
if (day <= 2)
{
printf("英语\n");
}
else if (day <= 5)
{
printf("数学\n");
}
else
{
printf("政治\n");
}
return 0;
}
大概就这样吧,没仔细测过,就简单试了试。