找不到突破口啊~~~~求帮助
题目:输入某年某月某日,判断这一天是这一年的第几天?
这程序我刚好写过。
#include<stdio.h>
runnian(int x )
{
int m;
m=-1;
if(x%4==0||(x%100==0&&x%400==0))
m=1;
else
m=-1;
return m;
}
int main()
{
int i,j,k,s;
printf("please input:\n");
scanf("%d,%d,%d",&i,&j,&k);
s=(j-1)*31+k;
if(j<8&&j%2==0)
{
if(runnian(i)==1)
s=s-2-(j/2-1);
else
s=s-3-(j/2-1);
}
if(j<8&&j%2!=0)
{
if(runnian(i)==1)
s=s-2-((j-1)/2);
else
s=s-3-((j-1)/2);
}
else if(j>=8&&j%2==0){
if(runnian(i)==1)
s=s-5-((j-8)/2);
else s=s-6-((j-8)/2);
}
if(j>=8&&j%2!=0){
if(runnian(i)==1)
s=s-5-((j-9)/2);
else s=s-6-((j-9)/2);
}
printf("这一天是第%d",s);
return 0;
}