【加试题】找出100到1 000之间满足以下条件的整数:该数和冥半万数合开后组成的数字串中不存在重复的数字。例如209,其平方数为43 681,209和43 681合并后的数字串“20943681”中无重复数字,209就是符合条件的数。运行界面加图所示,实现上述功能的VB代码如下,但加框处代码有错,请改正。
Private Sub Command1_Click()
Dim x As Integer,Y As Long,st
As String
For x=100 To 1 000
y=x^2
st=x&y ‘将数字x和y合并成不含空格的数字串st
If Then ‘①
List1. AddItem Str(x)&" "& Str(y)&" "&st
EndIf
Next x
End Sub
Function judge(s As String)As Boolean
Dim a(1 To 100)As String,i As Integer,j As Integer
judge=False
For i=1 To Len(s)
a(i)=Mid(s,i,1)
Next i
For i=1 To Len(s)-1
For j=i+1 To Len(s)
If Then Exit Function ‘②
Next j
Next i
judge=True
End Function