1个回答
展开全部
以前编的了,直接复制过来了,自己看着修改一下吧:
#include <stdio.h>
int main()
{
struct mydata
{
int year;
int month;
int day;
} date;
int days=0,month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
printf("Input year,month and day:\n");
scanf("%d%d%d",&date.year,&date.month,&date.day);
int i;
for(i=0;i<date.month;i++)
days+=month[i];
days+=date.day;
if((date.year%4==0&&date.year%100!=0)||(date.year%400==0))
if(date.month>=3)
days++;
printf("It is the %dth day\n",days);
return 0;
}
#include <stdio.h>
int main()
{
struct mydata
{
int year;
int month;
int day;
} date;
int days=0,month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
printf("Input year,month and day:\n");
scanf("%d%d%d",&date.year,&date.month,&date.day);
int i;
for(i=0;i<date.month;i++)
days+=month[i];
days+=date.day;
if((date.year%4==0&&date.year%100!=0)||(date.year%400==0))
if(date.month>=3)
days++;
printf("It is the %dth day\n",days);
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询