vb程序设计教程课后答案与实验题答案(第三版)(10)
Private Sub Command2_Click() Dim st$, n%, sum%
Open \Do While Not EOF(1) Input #1, st, n sum = sum + n
List1.AddItem st & \Loop Close #1
List1.AddItem \合计:\List1.AddItem \平均:\End Sub
H.3
H.4
Private Type studtype
no As String * 4 name As String * 6 mark As Single End Type
Dim student As studtype, stud(1 To 5) As studtype, t As studtype
Private Sub Command1_Click()
Open \With student .no = \
.name = \星期一\ .mark = 66 End With
Put #1, 1, student With student .no = \
.name = \星期二\ .mark = 99 End With
Put #1, 2, student With student .no = \
.name = \星期三\ .mark = 88 End With
Put #1, 3, student With student .no = \
.name = \星期四\ .mark = 55 End With
Put #1, 4, student With student .no = \
.name = \星期五\ .mark = 77 End With
Put #1, 5, student Close #1 End Sub
Private Sub Command2_Click()
Open \For i = 1 To 5 Get #1, i, student
Print student.no, student.name, student.mark stud(i) = student Next i Close #1 For i = 1 To 5 For j = i + 1 To 5
If stud(i).mark > stud(j).mark Then t = stud(i): stud(i) = stud(j): stud(j) = t Next Next i
Open \For i = 1 To 5 Put #2, i, stud(i) Next i Close #1 End Sub
Private Sub Command3_Click()
Open \For i = 1 To 5 Get #1, i, stud(i)
Print stud(i).no; stud(i).name; stud(i).mark Next i Close #1
End Sub
H.5
Private Type studtype no As Integer
name As String * 20 sex As String * 1 mark As Single End Type
Dim std As studtype Dim record As Integer
Private Sub Command1_Click() With std
.no = Val(Text1.Text) .name = Text2.Text
.sex = IIf(Option1.Value, \.mark = Val(Text3.Text) End With
Open \record = LOF(1) / Len(std) + 1 Label1.Caption = record Put #1, record, std Close #1 End Sub
Private Sub Command2_Click()
Open \record = Val(Text4.Text) Get #1, record, std Text1.Text = std.no Text2.Text = std.name If std.sex = \Option1.Value = True Else
Option2.Value = True End If
Text3.Text = std.mark
record = LOF(1) / Len(std) Close #1 End Sub
Private Sub Command3_Click()
With std
.no = Val(Text1.Text) .name = Text2.Text
.sex = IIf(Option1.Value, \.mark = Val(Text3.Text) End With
Open \record = Val(Text4.Text) Put #1, record, std Close #1 End Sub
Private Sub Command4_Click()
Open \record = 1
Get #1, record, std Text1.Text = std.no Text2.Text = std.name If std.sex = \Option1.Value = True Else
Option2.Value = True End If
Text3.Text = std.mark
record = LOF(1) / Len(std) Close #1
Text4.Text = 1 End Sub
Private Sub Command5_Click()
Open \record = Val(Text4.Text) - 1 If Val(Text4.Text) <= 1 Then
MsgBox \超出记录范围\警告\Else
Get #1, record, std Text1.Text = std.no Text2.Text = std.name If std.sex = \Option1.Value = True Else
Option2.Value = True End If
Text3.Text = std.mark
record = LOF(1) / Len(std) Close #1
Text4.Text = Val(Text4.Text) - 1 End If End Sub
Private Sub Command6_Click()
Open \record = Val(Text4.Text) + 1
If record > Val(Label1.Caption) Then
MsgBox \超出记录范围\警告\Else
Get #1, record, std Text1.Text = std.no Text2.Text = std.name If std.sex = \Option1.Value = True Else
Option2.Value = True End If
Text3.Text = std.mark
record = LOF(1) / Len(std) Close #1
Text4.Text = Val(Text4.Text) + 1 End If End Sub
Private Sub Command7_Click()
Open \record = Val(Label1.Caption) Get #1, record, std Text1.Text = std.no Text2.Text = std.name If std.sex = \Option1.Value = True Else
Option2.Value = True End If
Text3.Text = std.mark
record = LOF(1) / Len(std) Close #1
Text4.Text = record End Sub
…… 此处隐藏:253字,全部文档内容请下载后查看。喜欢就下载吧 ……相关推荐:
- [法律文档]苏教版七年级语文下册第五单元教学设计
- [法律文档]向市委巡视组进点汇报材料
- [法律文档]绵阳市2018年高三物理上学期第二次月考
- [法律文档]浅析如何解决当代中国“新三座大山”的
- [法律文档]延安北过境线大桥工程防洪评价报告 -
- [法律文档]激活生成元素让数学课堂充满生机
- [法律文档]2014年春学期九年级5月教学质量检测语
- [法律文档]放射科标准及各项计1
- [法律文档]2012年广州化学中考试题和答案(原版)
- [法律文档]地球物理勘查规范
- [法律文档]《12系列建筑标准设计图集》目录
- [法律文档]2018年宁波市专技人员继续教育公需课-
- [法律文档]工会委员会工作职责
- [法律文档]2014新版外研社九年级英语上册课文(完
- [法律文档]《阅微草堂笔记》部分篇目赏析
- [法律文档]尔雅军事理论2018课后答案(南开版)
- [法律文档]储竣-13827 黑娃山沟大开挖穿越说明书
- [法律文档]《产品设计》教学大纲及课程简介
- [法律文档]电动吊篮专项施工方案 - 图文
- [法律文档]实木地板和复合地板的比较
- 探析如何提高电力系统中PLC的可靠性
- 用Excel函数快速实现体能测试成绩统计
- 教师招聘考试重点分析:班主任工作常识
- 高三历史选修一《历史上重大改革回眸》
- 2013年中山市部分职位(工种)人力资源视
- 2015年中国水溶性蛋白市场年度调研报告
- 原地踏步走与立定教学设计
- 何家弘法律英语课件_第十二课
- 海信冰箱经销商大会——齐俊强副总经理
- 犯罪心理学讲座
- 初中英语作文病句和错句修改范例
- 虚拟化群集部署计划及操作流程
- 焊接板式塔顶冷凝器设计
- 浅析语文教学中
- 结构力学——6位移法
- 天正建筑CAD制图技巧
- 中华人民共和国财政部令第57号——注册
- 赢在企业文化展厅设计的起跑线上
- 2013版物理一轮精品复习学案:实验6
- 直隶总督署简介




