作者q08 (阿毅)
看板Visual_Basic
标题[VB6 ] 计算机的「累加」
时间Sun Mar 19 20:24:32 2006
目前的程式码我已经写成这样了
至於「累加」方面
我仍然没有头绪
想请各位帮忙
Command 1 是数字0 ~ 9
Command 2 是 + - * /
Command 3 是 =
Command 4 是清空
____________________________________________________________________
Dim num1 As Integer
Dim a As Integer
Private Sub Command1_Click(Index As Integer)
Label1.Caption = Val(Label1.Caption * 10) + Index
End Sub
Private Sub Command2_Click(Index As Integer)
num1 = Label1.Caption
Label1.Caption = 0
a = Index
End Sub
Private Sub Command3_Click()
Select Case a
Case 0
Label1.Caption = num1 + Label1.Caption
Case 1
Label1.Caption = num1 - Label1.Caption
Case 2
Label1.Caption = num1 * Label1.Caption
Case 3
Label1.Caption = num1 / Label1.Caption
End Select
End Sub
Private Sub Command4_Click()
num1 = 0
Label1.Caption = 0
End Sub
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.230.39.113
1F:推 windwofswold:找两个变数存数字 & operation 试试看吧 03/19 20:30
2F:推 q08:糟糕.....operation我还没学到 03/19 20:37
3F:推 windwofswold:我是指....."+-*/" ^^" 03/19 22:49
4F:推 q08:我有再写一个 num2 来存数字了,但是执行的很怪,希望给一点提 03/19 23:35
5F:→ q08:示吧! 03/19 23:40
6F:推 fumizuki:782篇可以参考 03/21 19:39