当前位置:主页>Visual Basic教程>文章内容
告诉你两种判断闰年的简单方法
来源: 作者: 发布时间:2007-04-29  
OptionExplicit

PrivateSubCommand1_Click()
Print2000
PrintIsLeapYearA(2000)
PrintIsLeapYearB(2000)
Print1999
PrintIsLeapYearA(1999)
PrintIsLeapYearB(1999)
Print1998
PrintIsLeapYearA(1998)
PrintIsLeapYearB(1998)
Print1997
PrintIsLeapYearA(1997)
PrintIsLeapYearB(1997)
Print1996
PrintIsLeapYearA(1996)
PrintIsLeapYearB(1996)
EndSub

FunctionIsLeapYearA(ByValyrAsInteger)AsBoolean
If((yrMod4)=0)ThenIsLeapYearA=((yrMod100)>0)Or((yrMod400)=0)
EndIf
EndFunction

PublicFunctionIsLeapYearB(ByValyrAsInteger)AsBoolean
IsLeapYearB=Day(DateSerial(yr,2,29))=29
EndFunction->


 
上一篇:如何用VB设计动画时钟举例   下一篇:如何获得系统光驱的盘符
 
  相关文章
·如何用VB设计动画时钟举例
·如何获得系统光驱的盘符
·使用VB建立WebServer一例
·一个关于乘法溢出问题的探讨
·用VB设计VCD播放器的方法与技巧
·如何使用文件复制对话框
·VB编程计算农历的计算方法
·使用Shell指令具有Wait的功能
·拒绝录入错误日期的编程方法
·ADO设定独占性的资料库
·VB创建、修改、删除WIN2K用户
·利用VB实现对IE的调用与控制
 
【关闭窗口】
推荐本站资源
最新文章