2011年3月21日 星期一

test

Private Sub Form_Load()
Me.Hide
Open App.Path & "\in.txt" For Input As #1
Open App.Path & "\out.txt" For Output As #2

Dim N1 As String, N2 As String, B As String, NS1 As Integer, NS2 As Integer, PLUS, tmp
Input #1, N1
Input #1, N2





Do Until Len(N1) = Len(N2)
If Len(N1) > Len(N2) Then
N2 = "0" & N2
Else
N1 = "0" & N1
End If
Loop
If N1 > N2 Then B = N1 Else B = N2
tmp = 0

For i = Len(B) To 1 Step -1

NS1 = Mid(N1, i, 1)
NS2 = Mid(N2, i, 1)

L = NS1 + NS2

If L + tmp <= 9 Then ans = (L + tmp) & ans Else ans = (L + tmp) Mod 10 & ans: tmp = (L + tmp) \ 10
If i = 1 And L + tmp > 9 Then ans = "1" & ans
Next

Print #2, ans

Close
Close

End
End Sub

2 則留言: