帮忙编写一个VB程序,根据年份判断属相,谢谢
答案:2 悬赏:40 手机版
解决时间 2021-04-05 21:59
- 提问者网友:嗝是迷路的屁
- 2021-04-05 09:58
帮忙编写一个VB程序,根据年份判断属相,谢谢
最佳答案
- 五星知识达人网友:平生事
- 2021-04-05 10:56
Dim Year As Integer
Dim Name As Integer
Year = Val(InputBox("请输人出生年份:", "生肖查询", 1977))
Label1.Caption = "您是" & Str(Year) + "年出生的生肖为:"
Name = Year Mod 12
Select Case Name
Case 4
Label2.Caption = "鼠"
Case 5
Label2.Caption = "牛"
Case 6
Label2.Caption = "虎"
Case 7
Label2.Caption = "兔"
Case 8
Label2.Caption = "龙"
Case 9
Label2.Caption = "蛇"
Case 10
Label2.Caption = "马"
Case 11
Label2.Caption = "羊"
Case 0
Label2.Caption = "猴"
Case 1
Label2.Caption = "鸡"
Case 2
Label2.Caption = "狗"
Case 3
Label2.Caption = "猪"
End Select
Dim Name As Integer
Year = Val(InputBox("请输人出生年份:", "生肖查询", 1977))
Label1.Caption = "您是" & Str(Year) + "年出生的生肖为:"
Name = Year Mod 12
Select Case Name
Case 4
Label2.Caption = "鼠"
Case 5
Label2.Caption = "牛"
Case 6
Label2.Caption = "虎"
Case 7
Label2.Caption = "兔"
Case 8
Label2.Caption = "龙"
Case 9
Label2.Caption = "蛇"
Case 10
Label2.Caption = "马"
Case 11
Label2.Caption = "羊"
Case 0
Label2.Caption = "猴"
Case 1
Label2.Caption = "鸡"
Case 2
Label2.Caption = "狗"
Case 3
Label2.Caption = "猪"
End Select
全部回答
- 1楼网友:迟山
- 2021-04-05 11:33
Private Sub Command1_Click()
n = Text1.Text
t = n Mod 12
If t = 4 Then Text2.Text = "鼠年"
If t = 5 Then Text2.Text = "牛年"
If t = 6 Then Text2.Text = "虎年"
If t = 7 Then Text2.Text = "兔年"
If t = 8 Then Text2.Text = "龙年"
If t = 9 Then Text2.Text = "蛇年"
If t = 10 Then Text2.Text = "马年"
If t = 11 Then Text2.Text = "羊年"
If t = 0 Then Text2.Text = "猴年"
If t = 1 Then Text2.Text = "鸡年"
If t = 2 Then Text2.Text = "狗年"
If t = 3 Then Text2.Text = "猪年"
End Sub
n = Text1.Text
t = n Mod 12
If t = 4 Then Text2.Text = "鼠年"
If t = 5 Then Text2.Text = "牛年"
If t = 6 Then Text2.Text = "虎年"
If t = 7 Then Text2.Text = "兔年"
If t = 8 Then Text2.Text = "龙年"
If t = 9 Then Text2.Text = "蛇年"
If t = 10 Then Text2.Text = "马年"
If t = 11 Then Text2.Text = "羊年"
If t = 0 Then Text2.Text = "猴年"
If t = 1 Then Text2.Text = "鸡年"
If t = 2 Then Text2.Text = "狗年"
If t = 3 Then Text2.Text = "猪年"
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯