标题:vb.net编写 我刚学不太懂
只看楼主
wangwubing
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2008-4-17
 问题点数:0 回复次数:2 
vb.net编写 我刚学不太懂
随机产生20个学生的成绩,统计各分数段人数。即0—59、60—69、70—79、80—89、90—100,并显示结果。产生的数据在Label1中显示,统计结果在Label2中显示。
搜索更多相关主题的帖子: 编写 
2008-10-18 18:06
fairy4
Rank: 4
等 级:贵宾
威 望:10
帖 子:738
专家分:267
注 册:2007-11-1
得分:0 
Dim rom As New Random
        Dim romcount As Integer
        Dim str As String
        Dim arr() As String
        Dim int60, int70, int80, int90, int100, intx As Int32
        ReDim arr(20)
        For x As Integer = 0 To 19
            romcount = rom.Next(0, 100)
            arr(x) = romcount
        Next
        For x As Integer = 0 To 19
            Application.DoEvents()
            str &= ";" & CStr(arr(x))
            intx = CInt(arr(x))
            Application.DoEvents()
            If 0 < intx And intx <= 59 Then
                int60 += 1
            ElseIf 60 <= intx And intx <= 69 Then
                int70 += 1
            ElseIf 70 <= intx And intx <= 79 Then
                int80 += 1
            ElseIf 80 <= intx And intx <= 89 Then
                int90 += 1
            ElseIf 90 <= intx And intx <= 100 Then
                int100 += 1
            End If
        Next

        Me.Label1.Text = str
        Me.Label2.Text = "0-59人数为:" & int60 & Chr(10) & _
        "60-69人数为:" & int70 & Chr(10) & _
        "70-79人数为:" & int80 & Chr(10) & _
        "80-89人数为:" & int90 & Chr(10) & _
        "90-100人数为:" & int100 & Chr(10)
有时候自己动手学的更快

一个人只有一个心脏,却有两个心房。一个住着快乐;一个住着悲伤。不要笑得太大声,不然会吵醒旁边的悲伤
2008-10-20 19:30
wangwubing
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2008-4-17
得分:0 
谢谢啊,我也要好好的学了啊!
2008-10-22 15:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-239062-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.900496 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved