Private Sub Form_Click()
Dim a As Integer
a = Val(InputBox("输入年份"))
If a Mod 400 = 0 Then
Print "是瑞年"
ElseIf a Mod 4 = 0 And a Mod 100 <> 0 Then
Print "是瑞年 "
Else
Print "不是瑞年"
End If
End Sub
Private Sub Command1_Click()
Dim y As Integer
If Text1.Text = "" Then
MsgBox "输入年份"
Else
y = Val(Text1.Text)
If (y Mod 4 = 0 And y Mod 100 <>0) Or y Mod 400 = 0 Then
Text2.Text = Text1.Text &"年是闰年"
Else
Text2.Text = Text1.Text &"年不是闰年"
End If
End If
End Sub
Private Sub Form_Load()
Text1 = ""
Text2 = ""
Command1.Caption = "判断"
End SubEnd Sub
Dim yea As IntegerDim LeapYear As Boolean
yea = InputBox("请输入年号:")
If ((yea Mod 4) = 0) Then
LeapYear = ((yea Mod 100) >0) Or ((yea Mod 400) = 0)
End If
If LeapYear Then MsgBox yea &"年是闰年。" Else MsgBox yea &"不是闰年"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)