VB随机产生10个不重复的大写英文字母,看看我哪边错了Private Sub Command1_Click()Dim a(1 To 10)Dim flag As Boolean, i%, j%RandomizeFor i = 1 To 10 Do a(i) = Int(26 * Rnd) + 65 flag = False For j = 1 To i - 1
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 15:26:49
VB随机产生10个不重复的大写英文字母,看看我哪边错了Private Sub Command1_Click()Dim a(1 To 10)Dim flag As Boolean, i%, j%RandomizeFor i = 1 To 10 Do a(i) = Int(26 * Rnd) + 65 flag = False For j = 1 To i - 1
VB随机产生10个不重复的大写英文字母,看看我哪边错了
Private Sub Command1_Click()
Dim a(1 To 10)
Dim flag As Boolean, i%, j%
Randomize
For i = 1 To 10
Do
a(i) = Int(26 * Rnd) + 65
flag = False
For j = 1 To i - 1
If a(i) = a(j) Then
flag = True
Exit For
End If
Next j
Loop While flg = True
Next i
Print "随机产生10个不重复的大写英文字母:"
For i = 1 To 10
Print Chr(a(i)),
Next i
End Sub
VB随机产生10个不重复的大写英文字母,看看我哪边错了Private Sub Command1_Click()Dim a(1 To 10)Dim flag As Boolean, i%, j%RandomizeFor i = 1 To 10 Do a(i) = Int(26 * Rnd) + 65 flag = False For j = 1 To i - 1
'试一下:
Private Sub Command1_Click()
Dim a(1 To 10) As String
Dim i As Integer,j As Integer
For i = 1 To 10
Randomize
a(i) = Chr(Int(26 * Rnd) + 65)
If i > 1 Then
For j = 1 To i - 1
If a(i) = a(j) Then Exit For
Next
End If
If j < i And i > 1 Then i = i - 1
Next
MsgBox Join(a,",")
End Sub