【计算机类职业资格】二级VISUAL+BASIC机试-36及答案解析.doc

上传人:progressking105 文档编号:1327579 上传时间:2019-10-17 格式:DOC 页数:3 大小:31KB
下载 相关 举报
【计算机类职业资格】二级VISUAL+BASIC机试-36及答案解析.doc_第1页
第1页 / 共3页
【计算机类职业资格】二级VISUAL+BASIC机试-36及答案解析.doc_第2页
第2页 / 共3页
【计算机类职业资格】二级VISUAL+BASIC机试-36及答案解析.doc_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

1、二级 VISUAL+BASIC 机试-36 及答案解析(总分:100.00,做题时间:90 分钟)1.在窗体上创建三个命令按钮,名称分别为 Command1、Command2 和 Command3,标题分别为“导入数据”、“计算”和“保存数据”,以及一个文本框,名称为 Text1。编写事件过程,使得在运行时,单击“导入数据”按钮,从考生文件里读入 data.txt 文件(其中有 20 个整数),在 Text1 中显示。单击“计算”,采用冒泡算法排序。单击“保存数据”,存入 out.txt 文件中。程序运行界面如图 29 所示。(分数:100.00)_二级 VISUAL+BASIC 机试-36

2、答案解析(总分:100.00,做题时间:90 分钟)1.在窗体上创建三个命令按钮,名称分别为 Command1、Command2 和 Command3,标题分别为“导入数据”、“计算”和“保存数据”,以及一个文本框,名称为 Text1。编写事件过程,使得在运行时,单击“导入数据”按钮,从考生文件里读入 data.txt 文件(其中有 20 个整数),在 Text1 中显示。单击“计算”,采用冒泡算法排序。单击“保存数据”,存入 out.txt 文件中。程序运行界面如图 29 所示。(分数:100.00)_正确答案:(Visual Basic 集成环境中,执行“文件”“新建工程”命令,选择“标准

3、 Exe”。创建窗体 Form1。(2)在工具箱中选择文本框控件,在窗体建立一个文本框 Text1,将其 Text 属性设为空。(3)在工具箱中选择命令按钮控件,在窗体上创建三个命令按钮,名称分别为 Command1、Command2 和Command3,标题分别为“导入数据”、“计算”和“保存数据”。(4)双击“导入数据”按钮,弹出代码窗口,在其中添加如下代码;Private Sub Command1_Click()Dim a As StringCall FindData(a)Text1.Text=aEnd SubSub FindData(a As String)Open App.Path

4、 “/“& “data.txt“For Input As #1Do While Not EOF(1)Input #1,aLoopClose #1End Sub(5)双击“计算”按钮,弹出代码窗口,在其中添加如下代码:Private Sub Command2_Click()Sub sort(a()As Integer)Dim n As IntegerFor i=1 To 15For j=1 To 15-iIf (a(j)a(j+1)Thenn=a(j)a(j)=a(j+1)a(j+1)=nEnd IfNext iNext iEnd Sub(6)双击“保存数据”按钮,弹出代码窗口,在其中添加如下

5、代码:Private Sub Command3_Click()Call SaveData(Text1.Text)End SubSub SaveData(str As String)Open AppPath & “/“ & “out.txt“ For Output As #1Print #1, aClose #1End Sub(7)按 F5 键运行程序。如图 29 所示。(8)执行“文件”“保存工程”命令,将工程文件命名为 ylc.vbp,窗体文件命名为 ylc.frm。)解析:解析 (1)该题与上机模拟题十二在基本操作上类似,都考查了文件的读入操作并在文本框中输出;对顺序文件的读入和输出的操作等。(2)该题重点考查了利用冒泡算法对数组元素进行排序。

展开阅读全文
相关资源
猜你喜欢
  • JIS C2110-1-2016 Solid electrical insulating materials -- Test methods for electric strength -- Part 1 Tests at power frequencies《固体电绝缘材料 电绝缘强度的试验方法 第1部分 工频下试验》.pdf JIS C2110-1-2016 Solid electrical insulating materials -- Test methods for electric strength -- Part 1 Tests at power frequencies《固体电绝缘材料 电绝缘强度的试验方法 第1部分 工频下试验》.pdf
  • JIS C2110-2-2016 Solid electrical insulating materials -- Test methods for electric strength -- Part 2 Tests using direct voltage《固体电绝缘材料 电绝缘强度的试验方法 第2部分 采用直流电压.pdf JIS C2110-2-2016 Solid electrical insulating materials -- Test methods for electric strength -- Part 2 Tests using direct voltage《固体电绝缘材料 电绝缘强度的试验方法 第2部分 采用直流电压.pdf
  • JIS C2110-3-2016 Solid electrical insulating materials -- Test methods for electric strength -- Part 3 Tests using impulse voltage《固体电绝缘材料 电绝缘强度的试验方法 第3部分 采用脉冲电.pdf JIS C2110-3-2016 Solid electrical insulating materials -- Test methods for electric strength -- Part 3 Tests using impulse voltage《固体电绝缘材料 电绝缘强度的试验方法 第3部分 采用脉冲电.pdf
  • JIS C2136-2017 Electrical insulating materials used under severe ambient conditions -- Test methods for evaluating resistance to tracking and erosion《在恶劣环境条件下使用.pdf JIS C2136-2017 Electrical insulating materials used under severe ambient conditions -- Test methods for evaluating resistance to tracking and erosion《在恶劣环境条件下使用.pdf
  • JIS C2139-3-1-2018 Dielectric and resistive properties of solid insulating materials -- Part 3-1 Determination of resistive properties (DC methods) -- Volume re.pdf JIS C2139-3-1-2018 Dielectric and resistive properties of solid insulating materials -- Part 3-1 Determination of resistive properties (DC methods) -- Volume re.pdf
  • JIS C2139-3-2-2018 Dielectric and resistive properties of solid insulating materials -- Part 3-2 Determination of resistive properties (DC methods) -- Surface r.pdf JIS C2139-3-2-2018 Dielectric and resistive properties of solid insulating materials -- Part 3-2 Determination of resistive properties (DC methods) -- Surface r.pdf
  • JIS C2139-3-3-2018 Dielectric and resistive properties of solid insulating materials -- Part 3-3 Determination of resistive properties (DC methods) -- Insulatio.pdf JIS C2139-3-3-2018 Dielectric and resistive properties of solid insulating materials -- Part 3-3 Determination of resistive properties (DC methods) -- Insulatio.pdf
  • JIS C2141-1992 Testing methods of ceramic insulators for electrical and electronic applications《电气和电子装置用陶磁绝缘子的试验方法》.pdf JIS C2141-1992 Testing methods of ceramic insulators for electrical and electronic applications《电气和电子装置用陶磁绝缘子的试验方法》.pdf
  • JIS C2142-2016 Solid electrical insulating materials -- Standard conditions for use prior to and during the testing《固体电绝缘材料 试验前和试验期间使用的标准条件》.pdf JIS C2142-2016 Solid electrical insulating materials -- Standard conditions for use prior to and during the testing《固体电绝缘材料 试验前和试验期间使用的标准条件》.pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1