正在加载图片...
End sub Private Sub Command4 Click O Unload Forml 隐藏主窗体 Unload Form2 显示“排序”窗体 (2)Form2窗体模块程序代码: Private Sub Commandl Click O “排序” Dim t As string Call Sort(t) End sub Private Sub Command2 Click o “返回” Form2 Hide 隐藏“排序”窗体 Forml show 显示主窗体 (3)标准模块程序代码: Public a(l To 10) As Single Function Max( As Single 求最大值 Dim m As single For 1=2 To 10 Next i End function Sub Sort(s as String) 排序 If a(i)>a(j)Then t= a(i): a(i)=a(j): a(j)=t End I Next j s+ Str(a(10)) End Sub 第8章习题 单选题 4.A 8.(1)D(2)D 填空 1.随机存取方式 3.(1)Open "StDatal txt" For Output As #1 (2)Write #1, StNo, StMb (3)Close #1 4.(1)Open "StDatal txt" For Input As #l (2)EOF(1 5.(1)13(2)Textl Text =9999"(3)TextI Text 6.(1)num+1 (4)Stno(num),TextlText (5)Stno(num)12 End Sub Private Sub Command4_Click() '"结束" Unload Form1 '隐藏主窗体 Unload Form2 '显示“排序”窗体 End End Sub (2) Form2 窗体模块程序代码: Private Sub Command1_Click() '“排序” Dim t As String Call Sort(t) Text1.Text = t End Sub Private Sub Command2_Click() '“返回” Form2.Hide '隐藏“排序”窗体 Form1.Show '显示主窗体 End Sub (3) 标准模块程序代码: Public a(1 To 10) As Single Function Max() As Single '求最大值 Dim m As Single m = a(1) For i = 2 To 10 If m < a(i) Then m = a(i) End If Next i Max = m End Function Sub Sort(s As String) '排序 s = "" For i = 1 To 9 For j = i + 1 To 10 If a(i) > a(j) Then t = a(i): a(i) = a(j): a(j) = t End If Next j s = s + Str(a(i)) + "," Next i s = s + Str(a(10)) End Sub 第 8 章习题 一、单选题 1. B 2. D 3.D 4.A 5. B 6. B 7. A 8. (1)D (2)D 9. B 二、填空题 1. 随机存取方式 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)
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有