当前位置: 高中信息技术 / 单选题
  • 1. (2021高三上·诸暨模拟) 回文字符串的特征是从左到右读和从右到左读是完全一样的,如“aba”、“aabbaa”,判断字符串中忽略“,”字符后,该字符串是否是回文字符串的VB程序段如下:

    s = "ab,,,cb,a"

    n = Len(s)

    i = 1: j = Len(s)

    flag = True

    Do While i <= j

        If Mid(s, i, 1) = Mid(s, j, 1) Then

            i = i + 1: j = j - 1

        Else

            

        End If

    Loop

    If flag = False Then Print ("不是回文") Else Print ("回文")

    方框中的代码由以下三部分组成:

    ① If Mid(s, i, 1) = "," Or Mid(s, i, 1) = "." Then i = i + 1

    ② If Mid(s, j, 1) = "," Or Mid(s, j, 1) = "." Then j = j – 1

    ③ If Mid(s, i, 1) <> "," And Mid(s, j, 1) <> "," Then flag = False: Exit Do

    下列选项中,代码顺序正确的是:(     )

    A . ①②③ B . ②①③ C . ②③① D . ③②①

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