为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/07/18 07:22:39
为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,
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,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
![为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,](/uploads/image/z/6806569-49-9.jpg?t=%E4%B8%BA%E4%BB%80%E4%B9%88%E8%BF%99%E4%B8%AA%E7%A8%8B%E5%BA%8F%E4%B8%AD%E7%9A%84%E8%AE%A1%E7%AE%97%E7%BB%93%E6%9E%9C%E4%B8%8D%E5%AF%B9%E5%91%A2%2C%E5%B0%B1%E6%98%AF%E7%AC%AC%E4%B8%80%E6%AC%A1%E6%AD%A3%E7%A1%AE%2C%E4%B9%8B%E5%90%8E%E5%B0%B1%E4%BC%9A%E5%87%BA%E7%8E%B0%E8%BF%90%E7%AE%97%E9%94%99%E8%AF%AF%2C)
你猜
为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,
为什么这个vf程序会出现嵌套错误?
LINGO错误,这段程序为什么会出现以下错误:
下雨之后为什么会出现彩虹呢?
按下列程序进行计算,如果第一次输入的数是20,而结果不大于100时,就把结果作为输入的数进行第二次运算,
按下类程序进行计算(如图),如果第一次输入的数是20,而结果不大于100时,那么就把结果作为输入的数再进行第二次运算,直
matlab 计算程序这样写为什么不对
小明学习了有理数运算法则后,编了一个计算程序,显示屏上出现的结果总等于所输入的有理数的平方与1的和.当他第一次输入-2,
excel表格公式计算为什么会出现错误
Matlab 为什么很容易就出现“out of memory”这个错误?
编写一个程序,计算两个非0实数的加减乘除的运算结果!谁帮我编写这个程序?
请问这个lingo程序为什么不对?