'----------------------民工大哥-----------------
'----------------------QQ:117131327-------------
Dim temp As String
Dim num1, fh, dian As Double
Private Sub Command1_Click(Index As Integer)
If Index <= 9 Then
temp = temp & Index
End If
Select Case Index
Case 12
num1 = temp
temp = ""
fh = 1
dian = 0
Case 15
If dian <> 1 Then
temp = temp & "."
dian = 1
End If
Case 16
Select Case fh
Case 1
temp = CStr(num1 + CDbl(temp))
Case 2
temp = CStr(num1 - CDbl(temp))
Case 3
temp = CStr(num1 * CDbl(temp))
Case 4
On Error GoTo n
temp = CStr(num1 / CDbl(temp))
n:
temp = "E"
End Select
Case 13
num1 = temp
temp = ""
fh = 2
dian = 0
Case 14
num1 = temp
temp = ""
fh = 3
dian = 0
Case 19
num1 = temp
temp = ""
fh = 4
dian = 0
Case 18
temp = "0"
dian = 0
Case 11
temp = 1 / CDbl(temp)
Case 10
temp = Sqr(CDbl(temp))
Case 17
temp = -CDbl(temp)
End Select
End Sub
Private Sub Timer1_Timer()
If Len(temp) <> 1 And Left(temp, 1) = 0 Then
Text1.Text = CStr(Format(temp))
Else
Text1.Text = temp
End If
If Left(temp, 1) = "." Then
Text1.Text = "0" & temp
End If
End Sub