指教,计算某年的某一天.哪些可以省略?
#include "stdio.h"main()
{
struct {int y;int m;int d;}x,y;
int i,j;
while (1)
{printf ("Please Input Date (YYYY-MM-DD) : ");
scanf ("%d-%d-%d",&x.y,&x.m,&x.d);
if ((1000<=x.y&&x.y<=9999)&&(0<x.m&&x.m<=12)&&(0<x.d&&x.d<=31)==1) break;
printf ("Error Year or Month or Date.\n");}
if ((x.y%4==0)&&((x.y%400==0)||(x.y%100==1)==1))
{
switch (x.m-1)
{
case 0:i=0;break;
case 1:i=31;break;
case 2:i=59;break;
case 3:i=90;break;
case 4:i=120;break;
case 5:i=151;break;
case 6:i=181;break;
case 7:i=212;break;
case 8:i=243;break;
case 9:i=273;break;
case 10:i=304;break;
case 11:i=334;break;
case 12:i=365;break;
default:printf ("Error Month\n");}
j=i+x.d;
printf ("Date is : %d",j);}
else
{
switch (x.m-1)
{
case 0:i=0;break;
case 1:i=31;break;
case 2:i=60;break;
case 3:i=91;break;
case 4:i=121;break;
case 5:i=152;break;
case 6:i=182;break;
case 7:i=213;break;
case 8:i=244;break;
case 9:i=274;break;
case 10:i=305;break;
case 11:i=335;break;
case 12:i=366;break;
default:printf ("Error Month\n");}
j=i+x.d;
printf ("Date is : %d",j);}