2007-09-20 14:52:51奶茶

VB程式-msgbox的成績平均+評語

Private Sub Command1_Click()
MsgBox ”請跟著提示輸入成績”
國 = InputBox(”請輸入國文成績”)
英 = InputBox(”請輸入英文成績”)
數 = InputBox(”請輸入數文成績”)
Label1.Caption = ”國文成績為” & 國 & ”分”
Label2.Caption = ”英文成績為” & 英 & ”分”
Label3.Caption = ”數文成績為” & 數 & ”分”
Avg = (Val(國) + Val(英) + Val(數)) / 3
Label4.Caption = ”平均” & Round(Avg, 2) & ”分”
If Avg >= 90 Then
MsgBox ”超強的”
Else
If Avg >= 60 And Avg < 90 Then
MsgBox ”還不錯”
Else
MsgBox ”要在加油”
End If
End If
End Sub

Private Sub Command2_Click()
Label1.Caption = ””
Label2.Caption = ””
Label3.Caption = ””
Label4.Caption = ””
End Sub