第8章习题
一、单选题
B 2. D 3.D
4.A 5. B 6. B
7. A 8. (1)D (2)D
9. B
二、填空题
随机存取方式
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)
编程及上机调试
1. 程序代码如下:
Dim d(1 To 20) As Integer
Private Sub Command1_Click() '"产生随机数"
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() '"结束"
End
End Sub
2. 本程序的用户界面和程序代码较为复杂,请见具体程序文件。