资源简介
输入年-月-日,再输入高考年,就可以计算出距离此年高考的时间
代码片段和文件信息
#include
void day_of_year(int yearint monthint dayint high_yearint *byday);
main()
{
int yearhigh_yearmonthdaypa;
printf(“输入年-月-日:\n“);
scanf(“%d%d%d“&year&month&day);
printf(“输入距离哪一年的高考:\n“);
scanf(“%d“&high_year);
int *byday=&day;
day_of_year(yearmonthdayhigh_year&day);
return 0;
}
void day_of_year(int yearint monthint dayint high_yearint *byday)
{
int kleappday=7;
int tap[2][13]={{0312831303130313130313031}{0312931303130313130313031}};
if(year==high_year)
{
if(month<=6||day<7)
{
leap=(year%4==0&&year%100!=0||year%400==0);
for(k=1;k day=day+tap[leap][k];
fo
评论
共有 条评论