[VB6 ] 計算機的「累加」

看板Visual_Basic作者 (阿毅)時間19年前 (2006/03/19 20:17), 編輯推噓5(501)
留言6則, 3人參與, 最新討論串1/1
目前的程式碼我已經寫成這樣了 至於「累加」方面 我仍然沒有頭緒 想請各位幫忙 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

03/19 20:30, , 1F
找兩個變數存數字 & operation 試試看吧
03/19 20:30, 1F

03/19 20:37, , 2F
糟糕.....operation我還沒學到
03/19 20:37, 2F

03/19 22:49, , 3F
我是指....."+-*/" ^^"
03/19 22:49, 3F

03/19 23:35, , 4F
我有再寫一個 num2 來存數字了,但是執行的很怪,希望給一點提
03/19 23:35, 4F

03/19 23:40, , 5F
示吧!
03/19 23:40, 5F

03/21 19:39, , 6F
782篇可以參考
03/21 19:39, 6F
文章代碼(AID): #147KlapQ (Visual_Basic)
文章代碼(AID): #147KlapQ (Visual_Basic)