[Visual Basic 6.0] 大整數運算 大數乘法 (使用 Array 字串)

摘要:[Visual Basic 6.0] 大整數運算 大數乘法 (使用 Array 字串)

[Visual Basic 6.0] 大整數運算 大數乘法 (使用 Array 字串)

 

 


Private Sub Command1_Click()
    Text3 = ""
    ReDim TempArray(999)
    
    K = 0
    
    For i = Len(Text1) To 1 Step -1
            NowIndex = K
        For j = Len(Text2) To 1 Step -1
            Temp = TempArray(NowIndex) + Mid(Text1, i, 1) * Mid(Text2, j, 1)
            TempArray(NowIndex + 1) = Temp \ 10 + TempArray(NowIndex + 1)
            TempArray(NowIndex) = Temp Mod 10
            NowIndex = NowIndex + 1
        Next j
            K = K + 1
    Next i
    
    For i = UBound(TempArray) To 0 Step -1
        Text3 = Text3 & TempArray(i)
    Next i
    
    Do Until Val(Mid(Text3, 1, 1)) <> 0
        Text3 = Mid(Text3, 2)
    Loop
End Sub

 

大數運算-大數乘法.rar

#0xDe 從分享中學習

#Facebook:ProgrammerDe (https://www.facebook.com/MicrosoftDes) 有問題歡迎提問