作者hsy1026 (好累喔.....)
看板Visual_Basic
标题[.NET] vb2005写的计算机...
时间Wed Jun 18 23:18:23 2008
请输入专案类型(网站专案或者应用程式专案):vb05 windows应用程式
我有看到版上的人在讨论VB06
我是用vb2005的
在尝试改写後
还是有些地方没有改好
麻烦知道的人帮我解答一下!
谢谢!^^
Public Class Form1
Dim p, q, o, r, X As Integer, a(1 To 2) As Double
Private Sub 1_Click(ByVal z As Integer)
Select Case z
Case Is <= 9
If o = 1 Then
p = 0
o = 0
a(1) = 0
a(2) = 0
End If
End Select
Select Case p
Case 0
Select Case z
Case 0
a(1) = Str(a(1)) & 0
Text1.Text = a(1)
Case 1
a(1) = Str(a(1)) & 1
Text1.Text = a(1)
Case 2
a(1) = Str(a(1)) & 2
Text1.Text = a(1)
Case 3
a(1) = Str(a(1)) & 3
Text1.Text = a(1)
Case 4
a(1) = Str(a(1)) & 4
Text1.Text = a(1)
Case 5
a(1) = Str(a(1)) & 5
Text1.Text = a(1)
Case 6
a(1) = Str(a(1)) & 6
Text1.Text = a(1)
Case 7
a(1) = Str(a(1)) & 7
Text1.Text = a(1)
Case 8
a(1) = Str(a(1)) & 8
Text1.Text = a(1)
Case 9
a(1) = Str(a(1)) & 9
Text1.Text = a(1)
End Select
Case 1
Select Case z
Case 0
a(2) = Str(a(2)) & 0
Text1.Text = a(2)
r = 1
Case 1
a(2) = Str(a(2)) & 1
Text1.Text = a(2)
r = 1
Case 2
a(2) = Str(a(2)) & 2
Text1.Text = a(2)
r = 1
Case 3
a(2) = Str(a(2)) & 3
Text1.Text = a(2)
r = 1
Case 4
a(2) = Str(a(2)) & 4
Text1.Text = a(2)
r = 1
Case 5
a(2) = Str(a(2)) & 5
Text1.Text = a(2)
r = 1
Case 6
a(2) = Str(a(2)) & 6
Text1.Text = a(2)
r = 1
Case 7
a(2) = Str(a(2)) & 7
Text1.Text = a(2)
r = 1
Case 8
a(2) = Str(a(2)) & 8
Text1.Text = a(2)
r = 1
Case 9
a(2) = Str(a(2)) & 9
Text1.Text = a(2)
r = 1
End Select
End Select
Select Case z
Case 10
If o = 1 Then
Else
If p = 1 Then
If r = 0 Then
a(2) = Text1.Text
r = 1
End If
Select Case q
Case 1
a(1) = a(1) + a(2)
Case 2
a(1) = a(1) - a(2)
Case 3
a(1) = a(1) * a(2)
Case 4
If a(2) = 0 Then
Text1.Text = "函数结果未定义"
Else
a(1) = a(1) / a(2)
End If
End Select
Text1.Text = a(1)
End If
End If
a(2) = 0
p = 1
q = 1
o = 0
r = 0
Case 11
If o = 1 Then
Else
If p = 1 Then
If r = 0 Then
a(2) = Text1.Text
r = 1
End If
Select Case q
Case 1
a(1) = a(1) + a(2)
Case 2
a(1) = a(1) - a(2)
Case 3
a(1) = a(1) * a(2)
Case 4
If a(2) = 0 Then
Text1.Text = "函数结果未定义"
Else
a(1) = a(1) / a(2)
End If
End Select
Text1.Text = a(1)
End If
End If
a(2) = 0
p = 1
q = 2
o = 0
r = 0
Case 12
If o = 1 Then
Else
If p = 1 Then
If r = 0 Then
a(2) = Text1.Text
r = 1
End If
Select Case q
Case 1
a(1) = a(1) + a(2)
Case 2
a(1) = a(1) - a(2)
Case 3
a(1) = a(1) * a(2)
Case 4
If a(2) = 0 Then
Text1.Text = "函数结果未定义"
Else
a(1) = a(1) / a(2)
End If
End Select
Text1.Text = a(1)
End If
End If
a(2) = 0
p = 1
q = 3
o = 0
r = 0
Case 13
If o = 1 Then
Else
If p = 1 Then
If r = 0 Then
a(2) = Text1.Text
r = 1
End If
Select Case q
Case 1
a(1) = a(1) + a(2)
Case 2
a(1) = a(1) - a(2)
Case 3
a(1) = a(1) * a(2)
Case 4
If a(2) = 0 Then
Text1.Text = "函数结果未定义"
Else
a(1) = a(1) / a(2)
End If
End Select
Text1.Text = a(1)
End If
End If
a(2) = 0
p = 1
q = 4
o = 0
r = 0
Case 14
If r = 0 Then
a(2) = Text1.Text
r = 1
End If
Select Case q
Case 1
a(1) = a(1) + a(2)
Case 2
a(1) = a(1) - a(2)
Case 3
a(1) = a(1) * a(2)
Case 4
If a(2) = 0 Then
Text1.Text = "函数结果未定义"
Else
a(1) = a(1) / a(2)
End If
End Select
Text1.Text = a(1)
o = 1
Case 15
Select Case p
Case 0
a(1) = 0
a(2) = 0
p = 0
q = 0
o = 0
r = 0
Text1.Text = 0
Case 1
a(2) = 0
o = 0
r = 0
Text1.Text = 0
End Select
Case 16
a(1) = 0
a(2) = 0
p = 0
q = 0
o = 0
r = 0
Text1.Text = 0
Case 17
If o = 1 Then
Else
Y = Str(Text1.Text)
X = Len(Y)
Select Case p
Case 0
If X - 1 = 1 Then
Text1.Text = 0
a(1) = 0
Else
a(1) = Left(Y, X - 1)
Text1.Text = a(1)
End If
Case 1
If X - 1 = 1 Then
Text1.Text = 0
a(2) = 0
Else
a(2) = Left(Y, X - 1)
Text1.Text = a(2)
End If
End Select
End If
End Select
End Sub
End Class
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.216.5.208
1F:→ MOONRAKER:有VB06吗?不是VB08喔? 06/19 01:00
2F:→ hsy1026:打错打错...是6.0啦.....= =" 06/19 07:00
3F:推 Marty:感觉好多Magic Number..建议稍为标一下注解和程式想法...^^ 06/19 11:41