大于塞外

// 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&&para.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();
 
}
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值