作者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