各位大虾,帮小弟看一下这段vb程序,很多问题,能不能帮我改一次啊,谢谢了。刚学这种语言,很多需要指导

2024-12-12 09:57:37
推荐回答(5个)
回答1:

你那裹脚布我屏住呼吸拉了一下,先把你的代码修改一下:使用command控件数组、使用select控制流程、在一个过程中使用with text1 ,,,end with 进行书写,你得考虑别人的感受啊
就一计算器至于把代码搞得像龙卷风的

回答2:

不明白你想做什么?

回答3:

请大师帮你吧

回答4:

回答5:

修改完毕,请你测试一下,我已经测试通过。

Dim M(55) As Integer, B(55) As String, t As Integer, k, n, i, j

Function fun1() As Integer
t = fun2
Do While B(n) = "->"
t = t Imp fun2
n = n + 1
Loop
End Function
Function fun2() As Integer
t = fun3
Do While B(n) = "v"
t = t Or fun3
n = n + 1
Loop
End Function
Function fun3() As Integer
t = fun4
Do While B(n) = "*"
t = t And fun4
n = n + 1
Loop
End Function
Function fun4() As Integer
t = fun5
Do While B(n) = "!"
t = Not fun5
n = n + 1
Loop
End Function

Function fun5() As Integer
Dim i As Integer
i = 0
If B(n) = "(" Then
n = n + 1
t = fun1
n = n + 1
ElseIf fun6 = True Then
M(i) = B(n)
End If
End Function
Function fun6()
If B(n) = "P" Or B(n) = "Q" Or B(n) = "R" Or B(n) = "(" Or B(n) = ")" Or B(n) = "v" Or B(n) = "->" Or B(n) = "*" Or B(n) = "!" Then
fun6 = 1
Else
MsgBox "error!"
End If
End Function

Private Sub Command1_Click()
Text1.Text = Text1.Text + "P"
M(k) = 1
k = k + 1
B(n) = "P"
n = n + 1
End Sub

Private Sub Command10_Click()
Text1.Text = Text1.Text + ")"
B(n) = ")"
n = n + 1

End Sub

Private Sub Command11_Click()
Text1.Text = ""
End Sub

Private Sub Command2_Click()
Text1.Text = Text1.Text + "Q"
M(k) = 1
k = k + 1
B(n) = "Q"
n = n + 1
End Sub

Private Sub Command3_Click()
Text1.Text = Text1.Text + "!"
B(n) = "!"
n = n + 1

End Sub

Private Sub Command4_Click()
Text1.Text = Text1.Text + "R"
M(k) = 1
k = k + 1
B(n) = "R"
n = n + 1
End Sub

Private Sub Command5_Click()
Text1.Text = Text1.Text + "*"
B(n) = "*"
n = n + 1

End Sub

Private Sub Command6_Click()
Text1.Text = Text1.Text + "V"
B(n) = "v"
n = n + 1

End Sub

Private Sub Command7_Click()
Text1.Text = Text1.Text + "->"
B(n) = "->"
n = n + 1

End Sub

Private Sub Command8_Click()
B(n) = Text1.Text

n = 0
t = fun1

Text1.Text = t
Cls

End Sub

Private Sub Command9_Click()
Text1.Text = Text1.Text + "("
B(n) = "("
n = n + 1

End Sub

张志晨