求一个闰年的小问题
输入个2000进去既然显示不是闰年。。。。。咋回事呢?
另外那个第六行那用/和%是不是都行啊?
#include <stdio.h>
void main()
{int year ,leap;
{printf("请输入一个年份:");
scanf("%d",&year);
if(year/400==0) leap==1;
else{if(year/100!=0&&year/4==0) leap==1;
else leap==0;}
}
if(leap==1)
printf("\n%d是闰年",year);
else
printf("\n%d不是闰年",year);
}
--------------------Configuration: ex3 - Win32 Debug--------------------
Compiling...
判断是否闰年.cpp
E:\VC++6.0\[大家网]Visual.C++.[www.]\MSDev98\MyProjects\ex3\判断是否闰年.cpp(6) : warning C4553: '==' : operator has no effect; did you intend '='?
E:\VC++6.0\[大家网]Visual.C++.[www.]\MSDev98\MyProjects\ex3\判断是否闰年.cpp(7) : warning C4553: '==' : operator has no effect; did you intend '='?
E:\VC++6.0\[大家网]Visual.C++.[www.]\MSDev98\MyProjects\ex3\判断是否闰年.cpp(8) : warning C4553: '==' : operator has no effect; did you intend '='?
E:\VC++6.0\[大家网]Visual.C++.[www.]\MSDev98\MyProjects\ex3\判断是否闰年.cpp(10) : warning C4700: local variable 'leap' used without having been initialized
判断是否闰年.obj - 0 error(s), 0 warning(s)