第28講 n進数演算−−−加法その2
第6話 n進法足し算プログラム解説その5
プログラム主要部分再掲
Sub ts(a() As Integer, b() As Integer, c() As Integer)
Dim i As Integer, j As Integer
Dim d(14) As Integer, e(14) As Integer
Call sy(d())
Call sy(e())
Dim asz As Integer, bsz As Integer
asz = cp(d(), a()) '終わり記号nをなくし、サイズを取得
bsz = cp(e(), b()) '終わり記号nをなくし、サイズを取得
Dim max As Integer
max = asz
If bsz > max Then max = bsz
For i = 0 To max
c(i) = c(i) + d(i) + e(i)
c(i + 1) = c(i + 1) + Int(c(i) / n)
c(i) = c(i) Mod n
Next
If c(max + 1) > 0 Then c(max + 2) = n Else c(max + 1) = n
End Sub