vb题 下面程序的功能是什么?Private Sub Command1_Click() Dim s%,n% Dim a As String n = 0 a = InputBox("Please input a number:") For s = 1 To Len(a) If (func(Val(Mid(a,s,1)))) Thenn = n + 1NextPrint n End Sub Private Function func(x%) As Bool
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/29 07:03:56
vb题 下面程序的功能是什么?Private Sub Command1_Click() Dim s%,n% Dim a As String n = 0 a = InputBox("Please input a number:") For s = 1 To Len(a) If (func(Val(Mid(a,s,1)))) Thenn = n + 1NextPrint n End Sub Private Function func(x%) As Bool
vb题 下面程序的功能是什么?
Private Sub Command1_Click()
Dim s%,n%
Dim a As String n = 0
a = InputBox("Please input a number:")
For s = 1 To Len(a)
If (func(Val(Mid(a,s,1)))) Then
n = n + 1
Next
Print n
End Sub
Private Function func(x%) As Boolean
If (x Mod 2 = 0) Then
func = True
Else
func = False
End If
End Function
vb题 下面程序的功能是什么?Private Sub Command1_Click() Dim s%,n% Dim a As String n = 0 a = InputBox("Please input a number:") For s = 1 To Len(a) If (func(Val(Mid(a,s,1)))) Thenn = n + 1NextPrint n End Sub Private Function func(x%) As Bool
Private Sub Command1_Click()
Dim s%, n%
Dim a As String
n = 0
a = InputBox("Please input a number:")
For s = 1 To Len(a)
If (func(Val(Mid(a, s, 1)))) Then n = n + 1'利用mid取每个输入的数字,然后利用func函数判断
Next
Print n
End Sub
'以上是command的click事件爱你,用来判断你输入的数字中有几个偶数,下面的是自定义函数,用来判断是否是偶数.
Private Function func(x%) As Boolean
If (x Mod 2 = 0) Then
func = True
Else
func = False
End If
End Function