Open App.Path & "\out.txt" For Output As #2 For ai = 1000 To 9999 For i = 1 To 3 For ii = i + 1 To 4 If Mid(ai, i, 1) = Mid(ai, ii, 1) Then ok(ai) = True Next Next Next
For iii = 1000 To 9999 If ok(iii) = False Then Print #2, iii Next Close #2
Private Sub Form_Load() Me.Hide Dim s As Boolean Open App.Path & "\out.txt" For Output As #2 For i = 1000 To 9999 s = False For j = 1 To 3 For k = j + 1 To 4 If Mid(i, j, 1) = Mid(i, k, 1) Then s = True: Exit For
Next If s = True Then Exit For Next
If s = False Then Print #2, i Next Close End End Sub
Private Sub Form_Load() Me.Hide Open App.Path & "\out.txt" For Output As #1 For i = 1000 To 9999 a = Right(i, 1) b = Mid(i, 3, 1) c = Mid(i, 2, 1) d = Left(i, 1) If a <> b And a <> c And a <> d And b <> c And b <> d And c <> d Then Print #1, d & c & b & a End If Next Close #1 End End Sub
Dim ok(9999) As Boolean
回覆刪除Private Sub Form_Load()
Open App.Path & "\out.txt" For Output As #2
For ai = 1000 To 9999
For i = 1 To 3
For ii = i + 1 To 4
If Mid(ai, i, 1) = Mid(ai, ii, 1) Then ok(ai) = True
Next
Next
Next
For iii = 1000 To 9999
If ok(iii) = False Then Print #2, iii
Next
Close #2
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Dim s As Boolean
Open App.Path & "\out.txt" For Output As #2
For i = 1000 To 9999
s = False
For j = 1 To 3
For k = j + 1 To 4
If Mid(i, j, 1) = Mid(i, k, 1) Then s = True: Exit For
Next
If s = True Then Exit For
Next
If s = False Then Print #2, i
Next
Close
End
End Sub
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\out.txt" For Output As #1
For i = 1000 To 9999
a = Right(i, 1)
b = Mid(i, 3, 1)
c = Mid(i, 2, 1)
d = Left(i, 1)
If a <> b And a <> c And a <> d And b <> c And b <> d And c <> d Then
Print #1, d & c & b & a
End If
Next
Close #1
End
End Sub
三位程式正確
回覆刪除復陞可以試試用迴圈的方式思維