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 number1(Len(N))
ReDim number2(Len(M))
Dim index As Byte
For index = 1 To Len(N)
number1(index) = Mid(N, index, 1)
For index = 1 To Len(M)
numbwe(index) = Mid(M, index, 1)
Next index
Dim result() As Byte
ReDim result(Len(N) + Len(M))
Dim Mcarry As Byte, Acarry As Byte
Dim i As Integer, j As Integer
For i = Len(M) To 1
For j = Len(N) To 1
result(i + j) = (Mcarry + (number2(i) * number1(j)) Mod 10 + result(i + j)) Mod 10
Mcarry = (number2(i) + number1(j)) \ 10
Next M
result(i) = Mcarry + Acarry
j = Len(N)
Mcarry = 0
Acarry = 0
End Sub
还有计算你生日那天是星期几的程序:
Private Sub Command1_Click()
Dim Year As Integer
Dim Month As Integer
Dim Day As Integer
Dim n As Integer
Dim birthday As Date
Year = Int(Val(Text1.Text))
Month = Int(Val(Text2.Text))
Day = Int(Val(Text3.Text))
birthday = DateSerial(Year, Month, Day)
n = Weekday(birthday)
Label6.Caption = WeekdayName(n)
End Sub
Private Function myweekdayname(n As Integer) As String
Select Case n
myweekday = "星期天"
Case Else
myweekday = "非星期天"
End Function