用inputbox函数输入一个年份月份,判断该月有多少天vb语言的不要其他什么c语言什么的!!!!!!
答案:3 悬赏:40
解决时间 2021-12-15 04:38
- 提问者网友:久伴不朽
- 2021-12-14 19:23
用inputbox函数输入一个年份月份,判断该月有多少天vb语言的不要其他什么c语言什么的!!!!!!
最佳答案
- 二级知识专家网友:闲懒诗人
- 2021-12-14 20:10
=======================================================================
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a = InputBox("请输入年份")
b = InputBox("请输入月份")
MsgBox CountDay(a, b)
End Sub
Private Function CountDay(Year As Integer, Month As Integer) As Integer
Dim count As Integer
count = -1
If Month = 1 Or Month = 3 Or Month = 5 Or Month = 7 Or Month = 8 Or Month = 10 Or Month = 12 Then
count = 31
ElseIf Month = 4 Or Month = 6 Or Month = 9 Or Month = 11 Then
count = 30
Else
If Year Mod 4 = 0 And Year Mod 100 <> 0 Or Year Mod 400 = 0 Then
count = 29
Else
count = 28
End If
End If
CountDay = count
End Function
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a = InputBox("请输入年份")
b = InputBox("请输入月份")
MsgBox CountDay(a, b)
End Sub
Private Function CountDay(Year As Integer, Month As Integer) As Integer
Dim count As Integer
count = -1
If Month = 1 Or Month = 3 Or Month = 5 Or Month = 7 Or Month = 8 Or Month = 10 Or Month = 12 Then
count = 31
ElseIf Month = 4 Or Month = 6 Or Month = 9 Or Month = 11 Then
count = 30
Else
If Year Mod 4 = 0 And Year Mod 100 <> 0 Or Year Mod 400 = 0 Then
count = 29
Else
count = 28
End If
End If
CountDay = count
End Function
全部回答
- 1楼网友:都不是誰的誰
- 2021-12-14 20:56
dim r as single
const pi = 3.1415926
private sub command1_click()
dim s as single
dim v as single
s = 4 * pi * r * r
text1.text = "球的表面积=" + cstr(s) + vbcrlf
v = 4 * pi * r * r * r / 3
text1.text = text1.text + "球的体积=" + cstr(v) + vbcrlf
end sub
private sub form_load()
r = inputbox("请输入球的半径:", "数据输入框", 0)
end sub
- 2楼网友:你好陌生人
- 2021-12-14 20:37
Private Sub Command1_Click()
y = Val(InputBox("请输入年份"))
m = Val(InputBox("请输入月份"))
MsgBox DaysOfMonth(y, m)
End Sub
Function DaysOfMonth(aYear, aMonth)
For i = 31 To 28 Step -1
If IsDate(CStr(aYear) & "- " & CStr(aMonth) & "- " & i) Then
DaysOfMonth = i
Exit Function
End If
Next
End Function
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
• 手机登qq时,显示手机磁盘不足,清理后重新登 |
• 刺客的套装怎么选啊? |