|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
void main()
{
int a,b,c,z;
printf("Please input the data:\n");
scanf("%d%d%d",&a,&b,&c);
if((a%100==0&&a%400==0)||(a%4==0&&a%100!=0)) //此处为 闰年(leap year)
{
if(b=1)
{
printf("Today is this year No%d day\n",c);}
else if(b=2)
{
z=c+31;
printf("Today is this year No%d day\n",z);}
else if(b=3)
{
z=c+60;
printf("Today is this year No%d day\n",z);}
else if(b=4)
{
z=c+91;
printf("Today is this year No%d day\n",z);}
else if(b=5)
{
z=c+121;
printf("Today is this year No%d day\n",z);}
else if(b=6)
{
z=c+152;
printf("Today is this year No%d day\n",z);}
else if(b=7)
{
z=c+182;
printf("Today is this year No%d day\n",z);}
else if(b=8)
{
z=c+213;
printf("Today is this year No%d day\n",z);}
else if(b=9)
{
z=c+244;
printf("Today is this year No%d day\n",z);}
else if(b=10)
{
z=c+274;
printf("Today is this year No%d day\n",z);}
else if(b=11)
{
z=c+274;
printf("Today is this year No%d day\n",z);}
else if(b=12)
{
z=c+335;
printf("Today is this year No%d day\n",z);}
}
else if((a%100==0&&a%400!=0)||a%4!=0) //此处为不是闰年
{
if(b=1)
{
printf("Today is this year No%d day\n",c);}
else if(b=2)
{
z=c+31;
printf("Today is this year No%d day\n",z);}
else if(b=3)
{
z=c+59;
printf("Today is this year No%d day\n",z);}
else if(b=4)
{
z=c+90;
printf("Today is this year No%d day\n",z);}
else if(b=5)
{
z=c+120;
printf("Today is this year No%d day\n",z);}
else if(b=6)
{
z=c+151;
printf("Today is this year No%d day\n",z);}
else if(b=7)
{
z=c+181;
printf("Today is this year No%d day\n",z);}
else if(b=8)
{
z=c+212;
printf("Today is this year No%d day\n",z);}
else if(b=9)
{
z=c+243;
printf("Today is this year No%d day\n",z);}
else if(b=10)
{
z=c+273;
printf("Today is this year No%d day\n",z);}
else if(b=11)
{
z=c+304;
printf("Today is this year No%d day\n",z);}
else if(b=12)
{
z=c+334;
printf("Today is this year No%d day\n",z);}
}
}
=号是赋值,==才是判断是否相等
把if的条件都改了吧
如果有帮助,请设最佳答案
|
|