1900至今年份属相表,输入任意年份计算该年生肖的程序
2023-07-08 07:56:30
设计一个程序,输入1900年以后的任意一个年份,计算该年的生肖.(
Private Sub Command1_Click
Dim y%, x%, s$
y = Val(InputBox("输入1900年以后的任意一个年份"))
If y >= 1900 Then
x = (y - 1900) Mod 12
Select Case x
Case 0
s = "鼠"
Case 1
s = "牛"
Case 2
s = "虎"
Case 3
s = "兔"
Case 4
s = "龙"
Case 5
s = "蛇"
Case 6
s = "马"
Case 7
s = "羊"
Case 8
s = "猴"
Case 9
s = "鸡"
Case 10
s = "狗"
Case 11
s = "猪"
End Select
MsgBox y & "年是" & s & "年"
Else
MsgBox "输入错误,年份必须大于等于1900"
End If
End Sub
此文为文章,请勿转载到任何平台!