实现上述功能的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
Dim i As Integer, j As Integer, k As Integer, c As Integer, n As Integer
List1.Clear
s = Text1.Text : n = Len(s)
If Then '选填 Label1.Caption = "数据输入有误!"
Exit Sub '退出 End If
For i = 0 To n - 1
a(i) = Mid(s, i + 1, 1) b(i) = 0
Next i c = 0
For i = 1 To n ^ n r = ""
For j = 0 To n - 1
Next j
c = c + 1 List1.AddItem r k = 0
b(k) = b(k) + 1
Do While b(k) = n And k < 4 b(k) = 0
b(k) = b(k) + 1 Loop
Next i
Label1.Caption = "构造字符串的方法共计" + Str(c) + "种。" End Sub
Function test(s As String) As Boolean ‘用于判别是否存在重复的字符,代码略
‘若无重复,则返回True,否则返回False
End Function
请回答下列问题:
② ③