当前位置: 高中信息技术 / 填空题
  • 1. (2021高三上·临河期中) 用随机数产生50个[10,100]不重复的正整数放入数组,从小到大排序,每行输出10个数。

    Private Sub Command1Click()

        Dim a(1 To 50) As Integer, i%, j%, t%, p%, n%, x%

        n=0

        Randomize

        Do While n<50

            x=

            For i= 1 To n

                If Then  Exit For

            Next i

            If i> n Then

               

                a(n)=x

            End If

        Loop

        For i= 1 To 49

           

            For j=i+ 1 To 50

                If a(p)> a(j) Then

            Next j

            t= a(p): a(p) = a(i): a(i)=t

        Next i

        For i= I To 50

            Print a(i);

            if Then Print

        Next i

    End Sub

微信扫码预览、分享更方便