当前位置: 高中信息技术 / 单选题
  • 1. (2020·浙江模拟) (加试题) 有如下 VB 程序段:

    Dim a(1 To 10) As Integer

    Dim s As String, n, i As Integer

    s = "54851845236": n = Len(s)

    For i = 1 To n - 1

        a(i) = Val(Mid(s, i, 2))

    Next i

    For i = 1 To n - 2

        k = i

        For j = i + 1 To n - 1

            If a(k) < a(j) Then k = j

        Next j

        If k <> i Then

            t = a(k): a(k) = a(i): a(i) = t

        End If

    Next i

    Text1.Text = Str(a(1))

    该程序段运行后,文本框 Text1 中显示的内容是:(    )

    A . 18 B . 54 C . 85 D . 8

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