Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim score, sum, max, m, n As Integer
Dim scorelist As String = "我輸入的分數分別為:"
m = InputBox("我總共要輸入幾個分數?")
For i = 1 To m
score = InputBox("請輸入第" & i & "科成績")
scorelist &= score & ","
sum = sum + score
If score > max Then max = score
If score < 60 Then n += 1
If i = m Then scorelist = Strings.Left(scorelist, Len(scorelist) - 1)
Next
TextBox1.Text = scorelist & ControlChars.CrLf
If CheckBox1.Checked Then TextBox1.Text =
TextBox1.Text & "總分為:" & sum & ControlChars.CrLf
If CheckBox2.Checked Then TextBox1.Text =
TextBox1.Text & "最高分數為:" & max & ControlChars.CrLf
If CheckBox3.Checked Then TextBox1.Text =
TextBox1.Text & "不及格科數:" & n & ControlChars.CrLf
End Sub
End Class
0 留言