以下是我的程式碼
拉個text1名稱為t1 開啟多行輸入
因56x64會錯誤,不能像十進位遇十就進位!!徵求那位大大幫我改一下
Private Sub Form_Activate()
N = Split((InputBox("", "")), "x")
If Len(N(0)) = 10 Or Len(N(1)) >= 10 Then Exit Sub
T1 = N(0) + vbCrLf + N(1) + vbCrLf + String(20, "-") + vbCrLf
For i = Len(N(1)) To 1 Step -1
L1 = Mid(N(1), i, 1)
For J = 1 To Len(N(0))
ANS = L1 * Mid(N(0), J, 1)
T1 = T1 & ANS
Next J
T1 = T1 & Space(x) & vbCrLf
x = x + 2
Next i
T1 = T1 & String(20, "-") + vbCrLf
A = N(0) * N(1)
T1 = T1 & A
End Sub
2006-10-19 21:15:28 · 2 個解答 · 發問者 公路殺手....小古是也 1 in 電腦與網際網路 ➔ 程式設計
Private Sub Command1_Click() Dim T%, S$, X%, N$(), I%, J% N = Split((InputBox("", "", "56x64")), "x") If Len(N(0)) = 10 Or Len(N(1)) >= 10 Then Exit Sub T = Len(CStr(N(0) * N(1))) T1 = Space((T - Len(N(0))) * 2) & N(0) & vbCrLf T1 = T1 & Space((T - Len(N(1))) * 2) & N(1) & vbCrLf & String(T \ 2, "-") & vbCrLf For I = Len(N(1)) To 1 Step -1 L1 = Mid(N(1), I, 1) For J = 1 To Len(N(0)) S = L1 * N(0) ANS = Space((T - Len(S) - (Len(N(1)) - I)) * 2) & S Next T1 = T1 & ANS & Space(X) & vbCrLf X = X + 2 Next T1 = T1 & String(T \ 2, "-") & vbCrLf T1 = T1 & N(0) * N(1)End Sub
2006-10-20 13:46:05 · answer #1 · answered by W.J.S. 7 · 0⤊ 0⤋
Dim temp(100) As Integer
Private Sub Form_Activate()
N = Split((InputBox("", "")), "x")
If Len(N(0)) = 10 Or Len(N(1)) >= 10 Then Exit Sub
T1 = N(0) & vbCrLf + N(1) + vbCrLf + String(20, "-") + vbCrLf
For I = Len(N(1)) To 1 Step -1
L1 = Mid(N(1), I, 1)
ANS = L1 * N(0)
If ANS = 0 Then
xx = Len(N(0))
If xx = 2 Then
ANS = Format(ANS, "0#")
ElseIf xx = 3 Then
ANS = Format(ANS, "0##")
ElseIf xx = 4 Then
ANS = Format(ANS, "0###")
ElseIf xx = 5 Then
ANS = Format(ANS, "0####")
ElseIf xx = 6 Then
ANS = Format(ANS, "0#####")
ElseIf xx = 7 Then
ANS = Format(ANS, "0######")
ElseIf xx = 8 Then
ANS = Format(ANS, "0#######")
ElseIf xx = 9 Then
ANS = Format(ANS, "0########")
End If
End If
T1 = T1 & ANS
T1 = T1 & Space(x) & vbCrLf
x = x + 4
Next I
T1 = T1 & String(20, "-") + vbCrLf
A = N(0) * N(1)
T1 = T1 & A
End Sub
2006-10-20 17:10:24 補充:
建議T1把文字置中對齊 會好看許多
2006-10-20 13:08:46 · answer #2 · answered by Shaodw_TCC 2 · 0⤊ 0⤋