option base 1
private sub command1_click()
dim m as string
dim n as string
m = trim(text1.text)
n = trim(text2.text)
dim number1() as byte
dim number2() as byte
redim number1(len(m))
redim number2(len(n))
dim index as byte
for index = 1 to len(m) step 1
number1(index) = mid(m, index, 1)
next index
for index = 1 to len(n) step 1
number2(index) = mid(n, index, 1)
next index
dim result() as byte
redim result(len(m) + len(n))
dim mcarry as byte
dim acarry as byte
dim remainder as integer
dim i as integer, j as integer
dim mtemp as integer, atemp as integer
for i = len(n) to 1 step -1
for j = len(m) to 1 step -1
mtemp = number1(j) * number2(i) + mcarry
mcarry = mtemp \ 10
remainder = mtemp mod 10
atemp = remainder + result(i + j) + acarry
acarry = atemp \ 10
result(i + j) = atemp mod 10
兩位數的乘法
private sub command1 click dim n as integer dim m as integer n trim text1.text m trim text2.text dim number1 as integer dim number2 as integer redim n...
不限制位數的大數乘法
include include using std cout using std cin using std string using std ostream using std istream class bignum bignum string v valuestr v string size ...
多位數乘法計算
option base 1 private sub command1 click dim m as string dim n as string m trim text1.text n trim text2.text dim number1 as byte dim number2 as byte r...