怎么解决调用sub出现“语句未结束”错误?

毕设驿站 课程设计 1
Dim n,a
n=Int(InputBox("n"))
a=Split("0 "&InputBox("a()"))
For i=1 To n
    For j=i+1 To n
        If a(j)<a(i) Then
            swap a(j) a(i)
        End If
    Next
Next
MsgBox(Join(a))
Sub swap(byRef x,byRef y)
    Dim z
    z=x
    x=y
    y=z
End Sub

回复

共2条回复 我来回复
  • 毕设海岸
    这个人很懒,什么都没有留下~
    评论
    Sub swap(ByRef x, ByRef y)
            Dim z
            z = x
            x = y
            y = z
        End Sub
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            Dim n, a
            n = Int(InputBox("n"))
            a = Split("0 " & InputBox("a()"))
            For i = 1 To n
                For j = i + 1 To n
                    If a(j) < a(i) Then
                        swap(a(j), a(i))
                    End If
                Next
            Next
            MsgBox(Join(a))
    
    
        End Sub
    
    0条评论
  • 代码港湾
    这个人很懒,什么都没有留下~
    评论
    Sub swap(ByRef x, ByRef y)
            Dim z
            z = x
            x = y
            y = z
        End Sub
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            Dim n, a
            n = Int(InputBox("n"))
            a = Split("0 " & InputBox("a()"))
            For i = 1 To n
                For j = i + 1 To n
                    If a(j) < a(i) Then
                        swap(a(j), a(i))
                    End If
                Next
            Next
            MsgBox(Join(a))
    
    
        End Sub
    
    0条评论

发表回复

登录后才能评论