【正文】
3. 讀操作 Get []文件號(hào), [記錄號(hào) ],變量名 忽略記錄號(hào),則讀出當(dāng)前記錄后的那一條記錄 。 private Sub Form_Click( ) Dim OneChar Open “”For Input As 1 Do While Not EOF(1) OneChar = Input$(1 , 1) Print OneChar。 例 4:建立一個(gè)工程,在該工程中新建一個(gè)名為Form1的窗體,窗體名為 。 private Sub Form_Click( ) Dim maxnum As Integer Dim minnum As Integer Dim temp As Integer 17 Dim total As Double Dim mean As Double Dim counter As Integer Open “”For Input As 1 While Not Eof(1) Input 1, temp counter = counter + 1 ?統(tǒng)計(jì)數(shù)據(jù)個(gè)數(shù) total = total + temp ?求出所有數(shù)值之和 ‘初始化最大值,最小值為文件中的第一個(gè)數(shù)據(jù) If (counter = 1)Then maxnum = temp minnum = temp End If 18 ?找到最大值 If( temp maxnum )Then maxnum = temp End If ?找到最小值 If( temp minnum )Then minnum = temp End If Wend Close 1 mean = total / counter ?求出平均值 Print “最大值為” 。 private Sub Form_Click( ) Open “a:\Tel\”For Output As 1 unti$