试题

试题 试卷

logo

题型:综合题 题类:常考题 难易度:困难

浙江省丽水市2018-2019学年高二下学期信息技术期末考试试卷

一段字符中的每个词(由大、小写字母组成)是倒序显示的,比如“Good night,Tom!”就倒序显示成“dooG thgin,moT!”。小王编写了一个VB程序,实现还原功能,即单击“还原”按钮后,将文本框Text1中倒序显示的内容还原,并在文本框Text2中输出结果。程序运行界面如图所示。

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

(1)、观察程序代码,“还原”按钮的对象名为
(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)、加框处代码有错,请改正。
举一反三
返回首页

试题篮