VB编程统计一个班级30名同学成绩分别在0~59,60~69,70~79,80~89,90~100
VB编程统计一个班级30名同学成绩分别在0~59,60~69,70~79,80~89,90~100分数段内的人数,并在窗体输出统计结果...
VB编程统计一个班级30名同学成绩分别在0~59,60~69,70~79,80~89,90~100分数段内的人数,并在窗体输出统计结果
展开
1个回答
展开全部
Dim cj(30) As Integer
For i = 1 To 30
cj(i) = Rnd * 100 ‘用随机数产生成绩 ,也可以自己输入
Print cj(i)
Select Case cj(i)
Case 0 To 59
p1 = p1 + 1
Case 60 To 69
p2 = p2 + 1
Case 70 To 79
p3 = p3 + 1
Case 80 To 89
p4 = p4 + 1
Case 90 To 100
p5 = p5 + 1
End Select
Next
Print
Print "0 to 59:"; p1
Print "60 To 69"; p2
Print "70 To 79:"; p3
Print "80 To 89:"; p4
Print "90 To 100:"; p5
End Sub
For i = 1 To 30
cj(i) = Rnd * 100 ‘用随机数产生成绩 ,也可以自己输入
Print cj(i)
Select Case cj(i)
Case 0 To 59
p1 = p1 + 1
Case 60 To 69
p2 = p2 + 1
Case 70 To 79
p3 = p3 + 1
Case 80 To 89
p4 = p4 + 1
Case 90 To 100
p5 = p5 + 1
End Select
Next
Print "0 to 59:"; p1
Print "60 To 69"; p2
Print "70 To 79:"; p3
Print "80 To 89:"; p4
Print "90 To 100:"; p5
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询