Dim A, B, ten As Integer Dim ori As String Private Sub Form_Load() Me.Hide Open App.Path & "\in.txt" For Input As #1 Open App.Path & "\out.txt" For Output As #2 strr = Split("0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", " ") Do Input #1, A, B, ori If A <> 10 Then For i = Len(ori) To 1 Step -1 For ii = 0 To UBound(strr) If Mid(ori, i, 1) = strr(ii) Then ten = ten + (ii * (A ^ (Len(ori) - i))): Exit For Next Next Else ten = Val(ori) End If Do y = strr(ten Mod B) ten = ten \ B ans = y & ans Loop Until ten = 0 Print #2, ans: ans = "" Loop Until EOF(1) Close #2 Close #1 End End Sub
Dim A, B, ten As Integer
回覆刪除Dim ori As String
Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2
strr = Split("0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z", " ")
Do
Input #1, A, B, ori
If A <> 10 Then
For i = Len(ori) To 1 Step -1
For ii = 0 To UBound(strr)
If Mid(ori, i, 1) = strr(ii) Then ten = ten + (ii * (A ^ (Len(ori) - i))): Exit For
Next
Next
Else
ten = Val(ori)
End If
Do
y = strr(ten Mod B)
ten = ten \ B
ans = y & ans
Loop Until ten = 0
Print #2, ans: ans = ""
Loop Until EOF(1)
Close #2
Close #1
End
End Sub