Dim a(9) As String Private Sub Form_Load() Open App.Path & "/in.txt" For Input As #1 Open App.Path & "/out.txt" For Output As #2 Input #1, strN x = Len(strN) \ 8 V = 1 For i = 1 To 8 For j = 1 To x b = Mid(strN, V, 1) If b <> "*" Then a(j) = a(j) & b Else a(j) = a(j) & " " End If V = V + 1 Next j Next i For i = 1 To x Print #2, a(i); Next i Close #2 Close #1 End Sub
Dim ans As String Dim a(10) As String Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Input #1, aa cot = Len(aa) / 8 For j = 0 To 7 For i = 1 To cot c = Mid(aa, i + j * cot, 1) If c = "*" Then a(i) = a(i) & " " Else a(i) = a(i) & c End If Next i Next j For i = 1 To cot ans = ans & a(i) Next i Close #1 Open App.Path & "\out.txt" For Output As #1 Print #2, ans Close #1 End Sub
Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Input #1, aa cot = Len(aa) / 8 For j = 0 To 7 For i = 1 To cot c = Mid(aa, i + j * cot, 1) If c = "*" Then a(i) = a(i) & " " Else a(i) = a(i) & c End If Next i Next j For i = 1 To cot ans = ans & a(i) Next i Close #1 Open App.Path & "\out.txt" For Output As #1 Print #1, ans Close #1 End Sub
Dim per(10) As String Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Line Input #1, x q = Len(x) \ 8 j = 1 Do Until j > q b1 = 0 For i = 1 To 8 per(j) = per(j) & Mid(x, j + q * b1, 1) b1 = b1 + 1 Next i j = j + 1 Loop For i = 1 To q ans = ans & per(i) ans = Replace(ans, "*", " ") Next i Print #2, ans Close #2 Close #1 End Sub
Dim a(10) As String Private Sub Form_Load() Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 Input #1, x n = Len(x) \ 8 k = 1 For i = 1 To 8 For j = 1 To n c = Mid(x, k, 1) a(j) = a(j) & c k = k + 1 Next j Next i For i = 1 To n ans = ans & a(i) Next i Print Replace(ans, "*", " ") Close #2 Close #1 End Sub
Dim a(9) As String
回覆刪除Private Sub Form_Load()
Open App.Path & "/in.txt" For Input As #1
Open App.Path & "/out.txt" For Output As #2
Input #1, strN
x = Len(strN) \ 8
V = 1
For i = 1 To 8
For j = 1 To x
b = Mid(strN, V, 1)
If b <> "*" Then
a(j) = a(j) & b
Else
a(j) = a(j) & " "
End If
V = V + 1
Next j
Next i
For i = 1 To x
Print #2, a(i);
Next i
Close #2
Close #1
End Sub
高仔好,
回覆刪除程式OK, 但是,果然數學上還要再加強,這題數學上的計數上可以讓程式更簡化哦。
Tlttgh**thecfit*oon*fnrg*it***negr*asei*
回覆刪除1,6,11,16,21,26,31,36,41->2,7,12,17,
y = len(strN)
x = y/8
for i =1 to y
k=1+((i-1)*x mod 40) + ((i-1)*x \40)
? #2,mid(strN,k,1);
next i
忘了加判斷"*"號了。
回覆刪除Dim ans As String
回覆刪除Dim a(10) As String
Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Input #1, aa
cot = Len(aa) / 8
For j = 0 To 7
For i = 1 To cot
c = Mid(aa, i + j * cot, 1)
If c = "*" Then
a(i) = a(i) & " "
Else
a(i) = a(i) & c
End If
Next i
Next j
For i = 1 To cot
ans = ans & a(i)
Next i
Close #1
Open App.Path & "\out.txt" For Output As #1
Print #2, ans
Close #1
End Sub
Dim ans As String
回覆刪除Dim a(10) As String
Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Input #1, aa
cot = Len(aa) / 8
For j = 0 To 7
For i = 1 To cot
c = Mid(aa, i + j * cot, 1)
If c = "*" Then
a(i) = a(i) & " "
Else
a(i) = a(i) & c
End If
Next i
Next j
For i = 1 To cot
ans = ans & a(i)
Next i
Close #1
Open App.Path & "\out.txt" For Output As #1
Print #1, ans
Close #1
End Sub
上面有錯,這是改過的...
小白好,
回覆刪除程式ok。(就錯#1 #2 ,這裡而已嗎?)
Dim per(10) As String
回覆刪除Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Line Input #1, x
q = Len(x) \ 8
j = 1
Do Until j > q
b1 = 0
For i = 1 To 8
per(j) = per(j) & Mid(x, j + q * b1, 1)
b1 = b1 + 1
Next i
j = j + 1
Loop
For i = 1 To q
ans = ans & per(i)
ans = Replace(ans, "*", " ")
Next i
Print #2, ans
Close #2
Close #1
End Sub
Dim a(10) As String
回覆刪除Private Sub Form_Load()
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
Input #1, x
n = Len(x) \ 8
k = 1
For i = 1 To 8
For j = 1 To n
c = Mid(x, k, 1)
a(j) = a(j) & c
k = k + 1
Next j
Next i
For i = 1 To n
ans = ans & a(i)
Next i
Print Replace(ans, "*", " ")
Close #2
Close #1
End Sub