看板 Visual_Basic 關於我們 聯絡資訊
目前正在學習VB~ 有個作業是~ 要我們把成績分等級 Dim a As Double Dim b As String Dim c As String Dim d As String Dim f As String Dim x As String b = "優秀" c = "不錯" f = "在加油" d = "不及格" x = "請數入正確數值" If 100 < a > 90 Then MessageBox.Show(b) ElseIf 89 < a > 80 Then MessageBox.Show(c) ElseIf 79 < a > 70 Then MessageBox.Show(f) ElseIf 69 < a > 60 Then MessageBox.Show(d) ElseIf a = 100 Then MessageBox.Show(b) ElseIf 0 < a > 100 Then MessageBox.Show(x) End If End Sub End Class 為什麼messagebox沒有跑出來?? 謝囉.... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.130.36.177
nobody1:If 100 < a > 90 Then 改成 If 100 < a and a> 90 Then 03/13 11:15
nobody1:以下類推~ 03/13 11:15
foxtien:If 100 < a > 90光這樣debug就不會過了吧!?1F正解 03/13 16:24
fumizuki:會過 ...假設100小於a得到true,再算true>90 為false 03/13 22:40
fumizuki:數學邏輯也錯 哪有a大於90大於100的假定條件的@@ 03/13 22:41
fumizuki:程式邏輯就是多個關係運算(> = < >= <= <>)之間要用 and 03/13 22:42
fumizuki:串接起來 才會得到正確的結果... 03/13 22:43
joyyoyo7288:好...我懂了@@ 03/14 00:39