VB中编制程序,根据用户输入的考试成绩,(90—100优秀,80—89良好……小于60不及格)。输出相应的等级
5个回答
展开全部
Private Sub Command1_Click()
If Text1.Text >= 90 And Text1.Text <= 100 Then
Print "优秀"
ElseIf Text1.Text >= 80 And Text1.Text < 90 Then
Print "良好"
ElseIf Text1.Text >= 70 And Text1.Text < 80 Then
Print "一般"
ElseIf Text1.Text >= 60 And Text1.Text < 70 Then
Print "及格"
Else: Print "不及格"
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
If Text1.Text >= 90 And Text1.Text <= 100 Then
Print "优秀"
ElseIf Text1.Text >= 80 And Text1.Text < 90 Then
Print "良好"
ElseIf Text1.Text >= 70 And Text1.Text < 80 Then
Print "一般"
ElseIf Text1.Text >= 60 And Text1.Text < 70 Then
Print "及格"
Else: Print "不及格"
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
展开全部
添加如下代码:
Private Sub Command1_Click()
Dim s(19), a(4), i, temp As Integer
Me.AutoRedraw = True
Cls
For i = 0 To 19
Randomize
s(i) = Int(Rnd * 101)
temp = Int(s(i) / 10)
If temp = 10 Then
a(4) = a(4) + 1
ElseIf temp < 5 Then
a(0) = a(0) + 1
Else
a(temp - 5) = a(temp - 5) + 1
End If
Print s(i)
Next
Print
Print "各分数段人数分别是:" & Join(a, " ")
End Sub
Private Sub Command1_Click()
Dim s(19), a(4), i, temp As Integer
Me.AutoRedraw = True
Cls
For i = 0 To 19
Randomize
s(i) = Int(Rnd * 101)
temp = Int(s(i) / 10)
If temp = 10 Then
a(4) = a(4) + 1
ElseIf temp < 5 Then
a(0) = a(0) + 1
Else
a(temp - 5) = a(temp - 5) + 1
End If
Print s(i)
Next
Print "各分数段人数分别是:" & Join(a, " ")
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim score As Single
score = Val(Text1.Text)
If score < 60 Then
Print "不及格"
ElseIf score <= 70 Then
Print "一般"
ElseIf score <= 80 Then
Print "中等"
ElseIf score <= 90 Then
Print "良好"
ElseIf score <= 100 Then
Print "优秀"
Else
Print "成绩有问题"
End If
End Sub
Dim score As Single
score = Val(Text1.Text)
If score < 60 Then
Print "不及格"
ElseIf score <= 70 Then
Print "一般"
ElseIf score <= 80 Then
Print "中等"
ElseIf score <= 90 Then
Print "良好"
ElseIf score <= 100 Then
Print "优秀"
Else
Print "成绩有问题"
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim i As Integer
Dim s As String
s = InputBox("请输入分数", "分数", "")
i = Val(s)
Select Case i
Case Is < 60
MsgBox "不合格"
Case Is < 70
MsgBox "一般"
Case Is < 90
MsgBox "良好"
Case Is <= 100
MsgBox "优秀"
End Select
End Sub
Dim i As Integer
Dim s As String
s = InputBox("请输入分数", "分数", "")
i = Val(s)
Select Case i
Case Is < 60
MsgBox "不合格"
Case Is < 70
MsgBox "一般"
Case Is < 90
MsgBox "良好"
Case Is <= 100
MsgBox "优秀"
End Select
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
Dim a As Double
a = CDbl(Me.Text1.Text)
Print Switch(a >= 90, "优秀", a >= 80, "良好", a >= 70, "中等", a >= 60, "及格", a <= 60, "不及格")
End Sub
Dim a As Double
a = CDbl(Me.Text1.Text)
Print Switch(a >= 90, "优秀", a >= 80, "良好", a >= 70, "中等", a >= 60, "及格", a <= 60, "不及格")
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询