精品午夜福利中文字av_国产成人综合网_av毛片免费观看网站_欧美影视国产综合_野花香视频中文免费观看_亚洲无码要在线视频_又粗又大又用力大交换好大好爽小静_欧美贵妇v办公室高跟鞋_亚洲国产高清a∨网站_免费中文少妇亚洲

知ing

VB語(yǔ)言程序設(shè)計(jì)(第三版)

林卓然 編 / 電子工業(yè)出版社

邊治霏 上傳

查看本書(shū)

第9章習(xí)題


單選題

1.B     2.D     3.D           

4.B     5. A     6. A

編程及上機(jī)調(diào)試

1. 程序代碼如下:

Private Sub Form_load()

         Dim x(3) As Single, y As Single

         On Error GoTo errln                                '以后出錯(cuò)時(shí)轉(zhuǎn)移到errln

         y = 2 / 0                                          '產(chǎn)生"除數(shù)為0"的錯(cuò)誤

         x(4) = 1                                           '產(chǎn)生"下標(biāo)越界"的錯(cuò)誤

         MsgBox ("終止程序的運(yùn)行")

         Unload Me                                          '卸載窗體

         End

errln:                                                 '標(biāo)號(hào)

Select Case Err.Number

       Case 11                                         '"除數(shù)為0"的錯(cuò)誤碼為11

          MsgBox ("除數(shù)為0(錯(cuò)誤碼為11),跳過(guò)該錯(cuò)誤")

          Resume Next                                  '返回

       Case 9                                          '"下標(biāo)越界"的錯(cuò)誤碼為9

            MsgBox ("下標(biāo)越界(錯(cuò)誤碼為9),跳過(guò)該錯(cuò)誤")

            Resume Next                                '返回

       Case Else                         '其他錯(cuò)誤處理

            MsgBox ("錯(cuò)誤發(fā)生在" & Err.Source _

                & ", 代碼為" & Err.Number _

                & ", 即" & Err.Description)

    End Select

End Sub

2.改正后的程序代碼如下:

Private Sub Form_Load()

         Show

         For i = 1 To 11

             Print Tab(20 - i);

             For j = 1 To 2 * i - 1

                If j <= i Then

                   k = j

               Else

                  k = 2 * i - j

               End If

               If k > 9 Then k = k + 7

               Print Chr(k + 48);

            Next j

         Next i

End Sub

3.(1) n = n + 1          (2) d(1, j) = d(3, j)          (3) d(i, 2) = d(i, 4)

   (4) i = j Or i + j = 5                (5) d(i, j) = d(i, j) + 1

   (6) n = 0                             (7) Text1.Text


查看更多