国产最新a级毛片无码专区_综合亚洲欧美日韩久久精品_日本成年片在线观看66_一本到九九av电影_一级毛片免费网站播放_国内精品久久人无码大片_国产人成视频99在线观看_欧美不卡在线一本二本_国产亚洲电影av_可以免费看黄色软件

知ing

VB語言程序設(shè)計(第三版)

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

邊治霏 上傳

查看本書

第5章習(xí)題

一、單選題

1.A     2. B     3.(1)C,(2)B            

4.B     5.C     6.A       

7.(1)B,(2)C,(3)B        

8. B     9. B     10. B

二、填空題

1.(1)4次,n=13   (2)3次,n=8  (3)3次,n=27   (4)3次,n=10   (5)1次,n=12

2.(1) Len(s)   (2) Mid(s, k, 1)    (3) c + t      (4) Text2.Text

3.(1) t = 1    (2) n = n + 1       (3) t = t * 2

4. 0             

5. Text           

6. 下拉列表框         

7. AddItem ,RemoveItem或Clear

8.(1)ItemA   (2) ItemD   (3) ItemD   (4) ItemA

9.(1) Mid(x, p + 3)   (2) p + 4   (3) InStr(p, x, "123")

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

1. 和數(shù)為:1.21。程序代碼如下:

Private Sub Form_Load()

       Show

       s = 0

       For k = 1 To 100

           s = s + 1 / (1 + k * 4)

       Next k

       Print s

End Sub

2. 程序代碼如下:

Private Sub Form_Load()

       Dim i As Integer, a As Integer, b As Integer, c As Integer

       Show

       For i = 100 To 999

           a = Int(i / 100)

           b = Int((i - 100 * a) / 10)

           c = i - 100 * a - 10 * b

           If a * a * a + b * b * b + c * c * c = i Then

                Print i

           End If

       Next i

End Sub

3. 在窗體上建立一個文本框Text1(初始值)、一個列表框List1(顯示結(jié)果)和一個命令按鈕Comd1(“查找”)。

Private Sub Comd1_Click()              '“查找”

       Dim n As Integer

       n = Val(Text1.Text)

List1.Clear:k = 0

       Do While k <= 99

            If Not (n Mod 7 = 0) Then     

                List1.AddItem n                     

                k = k + 1

            End If

            n = n + 1

       Loop

End Sub

4. 程序代碼如下:

Private Sub Form_Load()

       Show

       n = Val(InputBox("正整數(shù)n="))

       For i = 1 To n

          For j = i + 1 To n

             For k = j + 1 To n

                 If i * i + j * j = k * k Then

                     Print "("; i; ","; j; ","; k; ")"

                 End If

             Next k

          Next j

       Next i

End Sub

5.在窗體上建立一個列表框List1和一個“顯示表項”命令按鈕Command1。程序代碼如下:

Private Sub Command1_click()     '"顯示表項"按鈕單擊事件

       FontSize = 12

       Cls

       For i = 0 To List1.ListCount - 1      '逐項判斷

            If List1.Selected(i) Then        '真時為選中

                Print List1.List(i)

            End If

       Next i

End Sub

6.(1) Text1.Text   (2) UCase(x)    (3) t >= "A" And t <= "Z"    (4) y + x

7.程序代碼如下:

Private Sub Form_Load()

       Show

       Dim a As Single, xn0 As Single, xn1 As Single

       a = Val(InputBox("請輸入一個正數(shù)"))

       xn1 = a

       Do

           xn0 = xn1

           xn1 = (xn0 + a / xn0) / 2

       Loop While Abs(xn0 - xn1) >= 0.00001

       Print a; "的平方根為"; xn1

End Sub



查看更多