• 2021-04-14
    在窗体上画一个名称为 Command1 的命令按钮,然后编写下列通用过程和命令按钮的事件过程:
    Private Function fun(ByVal m As Integer)
    If m Mod 2=0 Then
    fun=2
    Else
    fun=1
    End If
    End Function
    Private Sub Command1_Click
    Dim i As Integer,s As Integer
    s=0
    For i = 1 To 5
    s=s+fun(i)
    Next
    Print s
    End Sub
    程序运行后,单击命令按钮,在窗体上显示的是