1个回答
展开全部
#include<stdio.h>
#include<stdlib.h>
#define L(x) (x%4==0)&&(x%100!=0)||(x%400==0)
struct days
{
int year;
int month;
int day
}*pD;
void main()
{
int sum;
pD= (struct days *) malloc(sizeof(struct days));
printf("请输入年月日:\n");
scanf("%d%d%d",&pD->year,&pD->month,&pD->day);
sum=0;
switch(pD->month)
{
case 1: sum+=31;
case 2: if(L(pD->year))
sum+=29;
else
sum+=28;
case 3: sum+=31;
case 4: sum+=30;
case 5: sum+=31;
case 6: sum+=30;
case 7: sum+=31;
case 8: sum+=31;
case 9: sum+=30;
case 10: sum+=31;
case 11: sum+=30;
case 12: sum+=31;
}
sum-=pD->day;
printf("%d\n",sum);
free(pD);
}
#include<stdlib.h>
#define L(x) (x%4==0)&&(x%100!=0)||(x%400==0)
struct days
{
int year;
int month;
int day
}*pD;
void main()
{
int sum;
pD= (struct days *) malloc(sizeof(struct days));
printf("请输入年月日:\n");
scanf("%d%d%d",&pD->year,&pD->month,&pD->day);
sum=0;
switch(pD->month)
{
case 1: sum+=31;
case 2: if(L(pD->year))
sum+=29;
else
sum+=28;
case 3: sum+=31;
case 4: sum+=30;
case 5: sum+=31;
case 6: sum+=30;
case 7: sum+=31;
case 8: sum+=31;
case 9: sum+=30;
case 10: sum+=31;
case 11: sum+=30;
case 12: sum+=31;
}
sum-=pD->day;
printf("%d\n",sum);
free(pD);
}
追问
可以把输出结果截图给我看嘛?
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询