會員 | 會VB的請進來一下 請大大幫我看以下程式錯在那裡,並告訴我要如何訂正,謝謝! Private Sub Command1_Click() A = Val(InputBox("請輸入A")) B = Val(InputBox("請輸入B")) B = Val(InputBox("請輸入C")) If A > B And A > C Then MsgBox "A最大" If B > C And B > A Then MsgBox "B最大" Else MsgBox "C最大" End If End Sub |
回覆 |
會員 | Private Sub Command1_Click() Dim A As Integer Dim B As Integer Dim C As Integer A = Val(InputBox("½Ð¿é¤JA")) B = Val(InputBox("½Ð¿é¤JB")) C = Val(InputBox("½Ð¿é¤JC")) If A > B And A > C Then MsgBox "A³Ì¤j" ElseIf B > C And B > A Then MsgBox "B³Ì¤j" Else MsgBox "C³Ì¤j" End If End Sub 我幫你改好了 你知道嗎? 這個程式跟我有生以來第一個程式一樣~都是在比大小 推薦你一個學VB的好地方 http://www.infoserv.com.tw/vb/ 當初我是在這學會VB的 |
回覆 |
會員 | Private Sub Command1_Click() A = Val(InputBox("請輸入A")) B = Val(InputBox("請輸入B")) C = Val(InputBox("請輸入C")) If A > B And A > C Then MsgBox "A最大" ElseIf B > C And B > A Then MsgBox "B最大" Else MsgBox "C最大" End If End Sub |
回覆 |
會員 | 提供一個之前我老師講過的解法 我覺得蠻不錯用的 a = Val(InputBox("請輸入A")) b = Val(InputBox("請輸入B")) c = Val(InputBox("請輸入C")) Min = 32768 If a < Min Then Min = a ElseIf b < Min Then Min = b ElseIf c < Min Then Min = c End If MsgBox Min 這樣不管是比較幾個數都可以用哦 多寫幾個 elseif 就好了 |
回覆 |
|
XML | RSS 2.0 | RSS |
本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。