为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,Dim a As Boolean,num(1) As String,cou As Byte,operatorPrivate Sub Command1_click(Index As Integer)If a ThenLabel3.Caption = ""Label4.Caption = ""a =
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 19:02:10
为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,Dim a As Boolean,num(1) As String,cou As Byte,operatorPrivate Sub Command1_click(Index As Integer)If a ThenLabel3.Caption = ""Label4.Caption = ""a =
为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,
Dim a As Boolean,num(1) As String,cou As Byte,operator
Private Sub Command1_click(Index As Integer)
If a Then
Label3.Caption = ""
Label4.Caption = ""
a = False
End If
If Index 10 Then
Label3.Caption = Label3.Caption & Index
num(cou) = num(cou) & Index
Else
Label3.Caption = Label3.Caption & "."
num(cou) = num(cou) & "."
Command1(10).Enabled = False
End If
End Sub
Private Sub Command2_click(Index As Integer)
If num(0) = "" Then Exit Sub
Select Case Index
Case 0:Label3.Caption = Label3.Caption & "+"
Case 1:Label3.Caption = Label3.Caption & "-"
Case 2:Label3.Caption = Label3.Caption & "*"
Case 3:Label3.Caption = Label3.Caption & "/"
End Select
operator = Index
cou = 1
For i = 0 To 3
Command2(i).Enabled = False
Next
Command1(10).Enabled = True
End Sub
Private Sub Command3_Click()
a = True
On Error GoTo a0
Select Case operator
Case 0
Label4.Caption = Val(num(0)) + Val(num(1))
Case 1
Label4.Caption = Val(num(0)) - Val(num(1))
Case 2
Label4.Caption = Val(num(0)) * Val(num(1))
Case 3
Label4.Caption = Val(num(0)) / Val(num(1))
End Select
For i = 0 To 3
Command2(i).Enabled = True
Next
cou = 0
Command1(10).Enabled = True
a0:
Exit Sub
End Sub
Private Sub Command4_Click()
Form2.Show
End Sub
Private Sub Form_Load()
setpicture = LoadPicture("9056820108141597682_w_.jpg")
num(0) = ""
num(1) = ""
cou = 0
a = True
End Sub
为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,Dim a As Boolean,num(1) As String,cou As Byte,operatorPrivate Sub Command1_click(Index As Integer)If a ThenLabel3.Caption = ""Label4.Caption = ""a =
你猜