当前位置: 高中信息技术 / 综合题
  • 1. (2019高二下·丽水期末) 一段字符中的每个词(由大、小写字母组成)是倒序显示的,比如“Good night,Tom!”就倒序显示成“dooG thgin,moT!”。小王编写了一个VB程序,实现还原功能,即单击“还原”按钮后,将文本框Text1中倒序显示的内容还原,并在文本框Text2中输出结果。程序运行界面如图所示。

    实现上述功能的VB程序如下,请回答下列问题:

    1. (1) 观察程序代码,“还原”按钮的对象名为
    2. (2) 请在①、②的划线处填入合适的代码 

      Function zf(s As String) As Boolean

        zf = False

      If  s >= "A" And s <= "Z" Or s >= "a" And s <= "z"  Then

                ①       

        End If

      End Function

      Private Sub rev_Click()

      Dim s As String, ch As String, rv As String, rv1 As String

      Dim i As Integer, j As Integer, k As Integer

      s = Text1.Text

      rv = "" : i = 1

      Do While True

        ch = Mid(s, i, 1)

        Do While Not zf(ch) And i < Len(s)

          rv = rv + ch

          i = i + 1

          ch = Mid(s, i, 1)

        Loop

        j = i

        ch = Mid(s, j, 1)

        Do While zf(ch) And j <= Len(s)

                 ②        

                    If j > Len(s) Then Exit Do

          ch = Mid(s, j, 1)

        Loop

        rv1 = ""

        For                   '改错

          rv1 = Mid(s,k,1)+rv1

        Next k

        rv = rv + rv1

      If j <= Len(s) Then rv = rv + Mid(s, j, 1)

        i = j + 1

        If i > Len(s) Then Exit Do

      Loop

      Text2.Text = rv

      End Sub

       ② 

    3. (3) 加框处代码有错,请改正。

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