Dim n As Integer = InputBox("請輸入總人數:", "提示", 0) "總人數 Dim s9, s8, s7, s6, s5 As Integer For i = 1 To n "迴圈填寫每個人的成績 Dim x As Double = InputBox("請輸入第" & i.ToString & "個人的成績:", "提示", 0) Dim c As Double = x / 10 Select Case c Case Is >= 9 "統計優秀 s9 += 1 Case Is >= 8 "統計良好 s8 += 1 Case Is >= 7 "統計中等 s7 += 1 Case Is >= 6 "統計及格 s6 += 1 Case Else "統計不及格 s5 += 1 End Select Next MsgBox("總人數:" & n.ToString & vbCrLf & "優秀:" & s9.ToString & vbCrLf & "良好:" & s8.ToString & vbCrLf & "中等:" & s7.ToString & vbCrLf & "及格:" & s6.ToString & vbCrLf & "不及格:" & s5.ToString)
Dim n As Integer = InputBox("請輸入總人數:", "提示", 0) "總人數 Dim s9, s8, s7, s6, s5 As Integer For i = 1 To n "迴圈填寫每個人的成績 Dim x As Double = InputBox("請輸入第" & i.ToString & "個人的成績:", "提示", 0) Dim c As Double = x / 10 Select Case c Case Is >= 9 "統計優秀 s9 += 1 Case Is >= 8 "統計良好 s8 += 1 Case Is >= 7 "統計中等 s7 += 1 Case Is >= 6 "統計及格 s6 += 1 Case Else "統計不及格 s5 += 1 End Select Next MsgBox("總人數:" & n.ToString & vbCrLf & "優秀:" & s9.ToString & vbCrLf & "良好:" & s8.ToString & vbCrLf & "中等:" & s7.ToString & vbCrLf & "及格:" & s6.ToString & vbCrLf & "不及格:" & s5.ToString)