第8章習(xí)題
一、單選題
B 2. D 3.D
4.A 5. B 6. B
7. A 8. (1)D (2)D
9. B
二、填空題
隨機(jī)存取方式
2. Get, Put
3.
(1) Open "StData1.txt" For Output As #1
(2) Write #1, StNo, StMb
(3) Close #1
4.
(1) Open "StData1.txt" For Input As #1
(2) EOF(1)
(3) Input #1, StNo, StMb
5.
(1)13
(2)Text1.Text = "9999"
(3)Text1.Text
6.
(1)num + 1
(2)Input
(3)num
(4) Stno(num), Text1.Text
(5)Stno(num)
編程及上機(jī)調(diào)試
1. 程序代碼如下:
Dim d(1 To 20) As Integer
Private Sub Command1_Click() '"產(chǎn)生隨機(jī)數(shù)"
For i = 1 To 20
d(i) = Int(1 + 99 * Rnd)
List1.AddItem d(i)
Next i
End Sub
Private Sub Command2_Click() '"保存"
Open "MyFile3.txt" For Output As #1
For i = 1 To 20
Write #1, d(i)
Next i
Close #1
End Sub
Private Sub Command3_Click() '"讀出"
Open "MyFile3.txt" For Input As #1
Do While Not EOF(1)
Input #1, x
List2.AddItem x
Loop
Close #1
End Sub
Private Sub Command4_Click() '"結(jié)束"
End
End Sub
2. 本程序的用戶界面和程序代碼較為復(fù)雜,請(qǐng)見具體程序文件。