当前位置: 高中信息技术 / 单选题
  • 1. 有如下VB程序段:

    Dim a(1 To 10) As Integer

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

    t = 0

    For i = 1 To n - 1

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

    Next i

    For i = 1 To n - 2 Step 2

        k = i

        For j = i + 2 To n - 1 Step 2

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

        Next j

        If k <> i Then

            temp = a(i): a(i) = a(k): a(k) = temp: t = t + 1

        End If

    Next i

    Text1.Text = Str(t)

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

    A . 1 B . 2 C . 3 D . 4

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