vb复数计算器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Dim save As String
Dim a As Single
Dim points, over, b, c, d, e As Boolean
Private Sub Command1_Click(Index As Integer) If over = True Then
Text1.Text = ""
End If
If b = True Then
Text1.Text = Text1.Text & Trim(Str(Index)) ElseIf c = True Then
Text2.Text = Text2.Text & Trim(Str(Index))
ElseIf d = True Then
Text4.Text = Text4.Text & Trim(Str(Index)) ElseIf e = True Then
Text5.Text = Text5.Text & Trim(Str(Index)) End If
over = False
End Sub
Private Sub Command2_Click()
If points = False Then
If b = True Then
If Text1.Text = "" Then
Text1.Text = 0 & "."
points = True
Else
Text1.Text = Text1.Text & "."
points = True
End If
ElseIf c = True Then
If Text2.Text = "" Then
Text2.Text = 0 & "."
points = True
Else
Text2.Text = Text2.Text & "."
points = True
End If
ElseIf d = True Then
If Text4.Text = "" Then
Text4.Text = 0 & "."
points = True
Else
Text4.Text = Text4.Text & "."
points = True
End If
ElseIf e = True Then
If Text5.Text = "" Then
Text5.Text = 0 & "."
points = True
Else
Text5.Text = Text5.Text & "."
points = True
End If
End If
End If
End Sub
Private Sub Command3_Click()
If b = True Then
If Text1.Text <> "" Then
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1) End If
ElseIf c = True Then
If Text2.Text <> "" Then
Text2.Text = Left(Text2.Text, Len(Text2.Text) - 1) End If
ElseIf d = True Then
If Text4.Text <> "" Then
Text4.Text = Left(Text4.Text, Len(Text4.Text) - 1) End If
ElseIf e = True Then
If Text5.Text <> "" Then
Text5.Text = Left(Text5.Text, Len(Text5.Text) - 1)
End If
End If
End Sub
Private Sub Command4_Click(Index As Integer)
Const Pi = 3.1415926
Select Case Index
Case 0
Text3.Text = Str(V al(Text1.Text) + V al(Text2.Text))
Text6.Text = Str(V al(Text4.Text) + V al(Text5.Text))
Text7.Text = Sqr(V al((Text4.Text) * V al(Text4.Text)) + (V al(Text1.Text) * V al(Text1.Text)))
Text8.Text = Sqr(V al((Text2.Text) * V al(Text2.Text)) + (V al(Text5.Text) * V al(Text5.Text)))
Text9.Text = Sqr(V al((Text3.Text) * V al(Text3.Text)) + (V al(Text6.Text) * V al(Text6.Text)))
Case 1
Text3.Text = Str(V al(Text1.Text) - V al(Text2.Text))
Text6.Text = Str(V al(Text4.Text) - V al(Text5.Text))
Text7.Text = Sqr(V al((Text4.Text) * V al(Text4.Text)) + (V al(Text1.Text) * V al(Text1.Text)))
Text8.Text = Sqr(V al((Text2.Text) * V al(Text2.Text)) + (V al(Text5.Text) * V al(Text5.Text)))
Text9.Text = Sqr(V al((Text3.Text) * V al(Text3.Text)) + (V al(Text6.Text) * V al(Text6.Text)))
Case 2
Text3.Text = Str(V al(Text1.Text) * V al(Text2.Text) - V al(Text4.Text) * V al(Text5.Text))
Text6.Text = Str(V al(Text1.Text) * V al(Text5.Text) + V al(Text4.Text) * V al(Text2.Text))
Text7.Text = Sqr(V al((Text4.Text) * V al(Text4.Text)) + (V al(Text1.Text) * V al(Text1.Text)))
Text8.Text = Sqr(V al((Text2.Text) * V al(Text2.Text)) + (V al(Text5.Text) * V al(Text5.Text)))
Text9.Text = Sqr(V al((Text3.Text) * V al(Text3.Text)) + (V al(Text6.Text) * V al(Text6.Text)))
Case 3
Text3.Text = (V al(Text1.Text) * V al(Text2.Text) + V al(Text4.Text) * V al(Text5.Text)) / (V al(Text2.Text) * V al(Text2.Text) + V al(Text5.Text) * V al(Text5.Text))
Text6.Text = (V al(Text4.Text) * V al(Text2.Text) - V al(Text1.Text) * V al(Text5.Text)) / (V al(Text2.Text) * V al(Text2.Text) + V al(Text5.Text) * V al(Text5.Text))
Text7.Text = Sqr(V al((Text4.Text) * V al(Text4.Text)) + (V al(Text1.Text) * V al(Text1.Text)))
Text8.Text = Sqr(V al((Text2.Text) * V al(Text2.Text)) + (V al(Text5.Text) *