// my123.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
//
#include <stdio.h>
#include <windows.h>
///
//
struct date
{
int day;
int year;
int month;
};
int Days(date para)
{
int i,days=0;
int days_table[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}};
int flag=((para.year%4==0&¶.year%100!=0)||para.year%400==0);
for(i=0;i<para.month;i++)
days+=days_table[flag][i];
for(i=1;i<=para.day;i++)
days++;
return days;
}
void main()
{
date appointDate;
int totalDays=0;
//输入日期的地方
appointDate.year=2901;
appointDate.month=11;
appointDate.day=2;
//
/* FILE *fp;
date a;
if((fp=fopen("DayJob.txt","rt"))==NULL)
{
printf("Cannot open file!");
return -1;
}
fscanf(fp, "%d", &a);
fclose(fp);*/
//
date temp;
temp.month=12;
temp.day=31;
for(int year=1990;year<=appointDate.year-1;year++)
{
temp.year=year;
totalDays+=Days(temp);
}
totalDays+=Days(appointDate);
if(totalDays%5==4||totalDays%5==0)
printf("睡觉!");
else
printf("打鱼!");
getchar(); getchar();
}