#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int result;
int temporary;
switch(year%4)
{
case 0:
result+=1;
if(month>2||month<8);
{
if(month%2==0);
{
result+=month/2*31+(month/2-1)*30+28;
printf("result");
}
else
{
result+=(month/2+1)*31+(month/2-1)30+28;
printf("result");
}
}
else if(month<2||month>0)
{
result+=31;
printf("result");
}
else if(month==2)
{
result+=31+28;
printf("result");
}
else if(month>=8)
{
month-7=temporary;
result+=(month/2+1)*31+(month/2-1)30+28;
if(temporary%2==0)
{
result+=temporary/2*31+(temporary/2-1)*30+28;
printf("result");
}
else
{
result+=(temporary/2+1)*31+(temporary/2-1)30+28;
printf("result");
}
}
default:
printf("%s\n"," 我失败了");
}
return 0;
}
修改后
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int result=0;
int temporary=0;
switch(year%4)
{
case 0:
result+=1;
if(month>2||month<8)
{
if(month%2==0)
{
result+=month/2*31+(month/2-1)*30+28+day;
printf("%d",result);
break;
}
else
{
result+=(month/2+1)*31+(month/2-1)*30+28+day;
printf("%d",result);
break;
}
}
else if(month<2||month>0)
{
result+=31+day;
printf("result");
break;
}
else if(month==2)
{
result+=31+28+day;
printf("result");
break;
}
else if(month>=8)
{
month-=7;
temporary=month;
month+=7;
result+=((month/2+1)*31+(month/2-1)*30+28)+day;
if(temporary%2==0)
{
result+=temporary/2*31+(temporary/2-1)*30+28+day;
printf("result");
break;
}
else
{
result+=(temporary/2+1)*31+(temporary/2-1)*30+28+day;
printf("result");break;
}
}
else
{
printf("%s\n","这里什么都没有");
}
default:
printf("%s\n"," 母鸡啊");
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int result=0;
int temporary=0;
switch(year%4)
{
case 0:
result+=1;
if(month>2||month<8)
{
if(month%2==0)
{
result+=month/2*31+(month/2-1)*30+28+day;
printf("%d",result);
break;
}
else
{
result+=(month/2+1)*31+(month/2-1)*30+28+day;
printf("%d",result);
break;
}
}
else if(month<2||month>0)
{
result+=31+day;
printf("result");
break;
}
else if(month==2)
{
result+=31+28+day;
printf("result");
break;
}
else if(month>=8)
{
month-=7;
temporary=month;
month+=7;
result+=((month/2+1)*31+(month/2-1)*30+28)+day;
if(temporary%2==0)
{
result+=temporary/2*31+(temporary/2-1)*30+28+day;
printf("result");
break;
}
else
{
result+=(temporary/2+1)*31+(temporary/2-1)*30+28+day;
printf("result");break;
}
}
else
{
printf("%s\n","这里什么都没有");
}
default:
printf("%s\n"," 母鸡啊");
}
return 0;
}