Dim str, str1, str2 As String Dim check(8) As Boolean Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, str strr = Split(str, " ") str1 = strr(0) str2 = strr(1) str = Mid(str1, 1, 3) For i = 1 To 8 If Mid(str2, i, 1) <> "A" And Mid(str2, i, 1) <> "B" And Mid(str2, i, 1) <> "C" And (Len(str) = 8 Or Len(str) < 8) Then str = str & Mid(str2, i, 1) Next Print #2, str Close #2 Close #1
Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As 2 Input #1, x x = Split(x) For i = 1 To 3 y = Mid(x(0), i, 1) ans = ans & y List1.AddItem (y) Next For j = 1 To 8 y = Mid(x(1), j, 1) For i = 0 To List1.ListCount - 1 If y = List1.List(i) Then y = "": Exit For Next If y <> "" Then ans = ans & y Next Print #2, ans Close #2 Close #1 End End Sub
Dim str, str1, str2 As String Dim check(8) As Boolean Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Me.Hide Input #1, str strr = Split(str, " ") str1 = strr(0) str2 = strr(1) str = Mid(str1, 1, 3) For i = 1 To 3 str2 = Replace(str2, Mid(str, i, 1), "") Next Print #2, str & Mid(str2, 1, 5) Close #2 Close #1 End End Sub
Dim p As Boolean Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Line Input #1, x x = Split(x, " ") For i = 1 To 3 s = Mid(x(0), i, 1) a = a & s Next For i = 1 To Len(x(1)) p = True z = Mid(x(1), i, 1) For k = 1 To 3 If z = Mid(a, k, 1) Then p = False: Exit For Next If p = True Then t = t & z Next Print #2, a & t Close Close End End Sub
Dim str, str1, str2 As String
回覆刪除Dim check(8) As Boolean
Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, str
strr = Split(str, " ")
str1 = strr(0)
str2 = strr(1)
str = Mid(str1, 1, 3)
For i = 1 To 8
If Mid(str2, i, 1) <> "A" And Mid(str2, i, 1) <> "B" And Mid(str2, i, 1) <> "C" And (Len(str) = 8 Or Len(str) < 8) Then str = str & Mid(str2, i, 1)
Next
Print #2, str
Close #2
Close #1
Private Sub Form_Load()
回覆刪除Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As 2
Input #1, x
x = Split(x)
For i = 1 To 3
y = Mid(x(0), i, 1)
ans = ans & y
List1.AddItem (y)
Next
For j = 1 To 8
y = Mid(x(1), j, 1)
For i = 0 To List1.ListCount - 1
If y = List1.List(i) Then y = "": Exit For
Next
If y <> "" Then ans = ans & y
Next
Print #2, ans
Close #2
Close #1
End
End Sub
Bob:
回覆刪除in1:ABCDEFGH EHADBCGF
out1: ABCEHDGF
in2: EHADFBGH CEHAGFBC
out2: EHAEHGF
復陞:
in1:ABCDEFGH EHADBCGF
out1: ABCEHDGF
in2: EHADFBGH CEHAGFBC
out2: EHACGFBC
Bob錯了,復陞對了,還有Bob的程式碼沒貼完整,很嚴重喔!
Dim str, str1, str2 As String
回覆刪除Dim check(8) As Boolean
Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Me.Hide
Input #1, str
strr = Split(str, " ")
str1 = strr(0)
str2 = strr(1)
str = Mid(str1, 1, 3)
For i = 1 To 3
str2 = Replace(str2, Mid(str, i, 1), "")
Next
Print #2, str & Mid(str2, 1, 5)
Close #2
Close #1
End
End Sub
Dim p As Boolean
回覆刪除Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Line Input #1, x
x = Split(x, " ")
For i = 1 To 3
s = Mid(x(0), i, 1)
a = a & s
Next
For i = 1 To Len(x(1))
p = True
z = Mid(x(1), i, 1)
For k = 1 To 3
If z = Mid(a, k, 1) Then p = False: Exit For
Next
If p = True Then t = t & z
Next
Print #2, a & t
Close
Close
End
End Sub