为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/09/04 21:13:49
为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,
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
你猜
为什么这个程序中的计算结果不对呢,就是第一次正确,之后就会出现运算错误,
为什么这个vf程序会出现嵌套错误?
LINGO错误,这段程序为什么会出现以下错误:
下雨之后为什么会出现彩虹呢?
按下列程序进行计算,如果第一次输入的数是20,而结果不大于100时,就把结果作为输入的数进行第二次运算,
按下类程序进行计算(如图),如果第一次输入的数是20,而结果不大于100时,那么就把结果作为输入的数再进行第二次运算,直
matlab 计算程序这样写为什么不对
小明学习了有理数运算法则后,编了一个计算程序,显示屏上出现的结果总等于所输入的有理数的平方与1的和.当他第一次输入-2,
excel表格公式计算为什么会出现错误
Matlab 为什么很容易就出现“out of memory”这个错误?
编写一个程序,计算两个非0实数的加减乘除的运算结果!谁帮我编写这个程序?
请问这个lingo程序为什么不对?