VB 6.0 講義 - 用陣列來做處理成績
一維陣列處理單一科成績
1. 在命令鈕下撰寫程式碼
Dim s(5) As Integer For i = 1 To 5 s(i) = Val(InputBox("score ?")) Next i Sum = 0 Max = 0 Min = 100 For i = 1 To 5 If Max < s(i) Then Max = s(i) If Min > s(i) Then Min = s(i) Print "no. "; i; "'s score is "; s(i) Sum = Sum + s(i) Next i Print " Average : "; Sum / 5 Print " Max : ", Max Print " Min : ", Min