[VB6 ] 計算機的「累加」
目前的程式碼我已經寫成這樣了
至於「累加」方面
我仍然沒有頭緒
想請各位幫忙
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
03/19 20:30, 1F
推
03/19 20:37, , 2F
03/19 20:37, 2F
推
03/19 22:49, , 3F
03/19 22:49, 3F
推
03/19 23:35, , 4F
03/19 23:35, 4F
→
03/19 23:40, , 5F
03/19 23:40, 5F
推
03/21 19:39, , 6F
03/21 19:39, 6F
Visual_Basic 近期熱門文章
PTT數位生活區 即時熱門文章