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
next j
result(i) = mcarry + acarry
mcarry = 0
acarry = 0
next i
dim mstr as string
for index = 1 to len(n) + len(m)
mstr = mstr & str(result(index))
next
label3.caption = mstr
end sub
end sub
兩位數的乘法
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...
兩位數乘法的速算方法(一)
兩位數乘法的速算方法 一 講的是兩位自然數的相乘,即如何計算abxcd的相乘結果,例如86x32。ab叫被乘數 cd叫乘數 設兩位數分別是10a b,10c d,其乘積為s,根據多項式展開 s 10a b x 10c d 10a x 10c b x 10c 10a x d bxd。所謂速算,就是根據...
兩位數乘法的速算方法(二)
兩位數乘法的速算方法 二 公式推導 10 a a 10b 10 b 100ab 10 a x 10 b ab a 10 b 100ab 100a ab 100a b 1 ab 速算方法 1.乘數首位加1,得出的和與被乘數首位相乘,得數作為前積 2.尾數相乘,得數作為後積,沒有十位用0補 應用舉例 6...