组卷题库 > 高中信息技术试卷库
试题详情
编写字符串全排列程序, 实现如下功能:输入不重复的N个字符(2≤N≤5),输出该字符串全排列的情况。程序运行界面如图所示。实现上述功能的VB代码如下,请回答以下问题:

Private Sub Command1_Click()

    Dim a(0 To 4) As String

    Dim b(0 To 4) As Integer

    Dim s As String, r As String ,i As Integer, j As Integer

    List1. Clear

    s = Text1.Text: n = Len(s)

    For i=0 To n-1

       a(i) = Mid(s, i+ 1, 1)

       b(i) =   ①   

    Next i

    c =0

    For i=1 To n^n

    r =“”

    For j=0 To n-1

        r=   ②   

    Next j

    List1. AddItem r

    k=n-1

    b(k)=b(k)+1

    Do While b(k)=n And k>0

        b(k) = n-1    '③改错

        k=k-1

        b(k)=b(k)+1

      Loop

    Next i

End Sub

知识点
参考答案
采纳过本试题的试卷
教育网站链接