vb计算代码,求三个数的和,求最大数减最小数

1个回答

  • 本人没学过 只是编程爱好者 献丑了

    问题1

    Private Sub Command1_Click()

    Text3 = ""

    Dim A1 As Integer

    Dim A2 As Integer

    Dim A3 As Integer

    A1 = Text2

    A2 = 1 & Text2

    A3 = 2 & Text2

    AAAA = Split(Text1, " ")

    For Each I In AAAA

    Dim B1 As Integer

    Dim B2 As Integer

    Dim B3 As Integer

    B1 = Left(I, 1)

    B2 = Mid(I, 2, 1)

    B3 = Mid(I, 3, 1)

    Select Case B1 + B2 + B3

    Case A1

    Case A2

    Case A3

    Case Else

    Text3 = Text3 & " " & I

    End Select

    Next

    Text3 = Mid(Text3, 2, Len(Text3))

    End Sub

    问题2

    Private Sub Command1_Click()

    Text3 = ""

    Dim A1 As Integer

    A1 = Text2

    AAAA = Split(Text1, " ")

    For Each I In AAAA

    Dim B1 As Integer

    Dim B2 As Integer

    Dim B3 As Integer

    Dim B4 As Integer

    Dim B5 As Integer

    B1 = Left(I, 1)

    B2 = Mid(I, 2, 1)

    B3 = Mid(I, 3, 1)

    B4 = B1

    B5 = B1

    If B2 > B4 Then B4 = B2

    If B3 > B4 Then B4 = B3

    If B2 < B5 Then B5 = B2

    If B3 < B5 Then B5 = B3

    If Not (B4 - B5 = A1) Then Text3 = Text3 & " " & I

    Next

    Text3 = Mid(Text3, 2, Len(Text3))

    End Su