标题:求一个闰年的小问题
取消只看楼主
卡卡爱刷牙
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2009-8-3
结帖率:93.33%
已结贴  问题点数:5 回复次数:0 
求一个闰年的小问题
输入个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)
搜索更多相关主题的帖子: 闰年 else 
2009-08-23 13:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-283497-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.207142 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved