vb程序论述题

2024-12-21 00:37:08
推荐回答(1个)
回答1:

1
Private Sub Command1_Click()
a = InputBox("")
If 100 >= a And a >= 90 Then
MsgBox "优秀"
ElseIf 90 > a And a >= 80 Then
MsgBox "良好"
ElseIf 80 > a And a >= 70 Then
MsgBox "中等"
ElseIf 70 > a And a >= 60 Then
MsgBox "及格"
ElseIf 60 > a And a >= 0 Then
MsgBox "不及格"
else
msgbox "错误"
End If
End Sub
2.
Private Sub Command2_Click()
a = InputBox("")
For i = 1 To 2
If Val(a) Mod 400 = 0 Then
MsgBox "它是闰年"
Exit Sub
End If
If Val(a) Mod 400 <> 0 And Val(a) Mod 100 = 0 And Val(a) Mod 4 = 0 Then
MsgBox "它是闰年"
Exit Sub
End If
Next
MsgBox "它不是闰年"
End Sub