【计算机类职业资格】二级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)该题重点考查了利用冒泡算法对数组元素进行排序。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 1319-2010 Domestic gas-fired forced convection air heaters for space heating with fan-assisted burners not exceeding a net heat input of 70 kW German version EN 1319 2009《有鼓.pdf DIN EN 1319-2010 Domestic gas-fired forced convection air heaters for space heating with fan-assisted burners not exceeding a net heat input of 70 kW German version EN 1319 2009《有鼓.pdf
  • DIN EN 13190-2002 Dial thermometers German version EN 13190 2001《指针式温度计 德文版本 EN 13190 2001》.pdf DIN EN 13190-2002 Dial thermometers German version EN 13190 2001《指针式温度计 德文版本 EN 13190 2001》.pdf
  • DIN EN 13191-1-2000 Non-fatty foods - Determination of bromide residues - Part 1 Determination of total bromide as inorganic bromide German version EN 13191-1 2000《清淡食物 溴化物残留物的测定 第.pdf DIN EN 13191-1-2000 Non-fatty foods - Determination of bromide residues - Part 1 Determination of total bromide as inorganic bromide German version EN 13191-1 2000《清淡食物 溴化物残留物的测定 第.pdf
  • DIN EN 13191-2-2000 Non-fatty foods - Determination of bromide residues - Part 2 Determination of inorganic bromide German version EN 13191-2 2000《清淡食物 溴化物残留物的测定 第2部分 无机溴化物含量的测定》.pdf DIN EN 13191-2-2000 Non-fatty foods - Determination of bromide residues - Part 2 Determination of inorganic bromide German version EN 13191-2 2000《清淡食物 溴化物残留物的测定 第2部分 无机溴化物含量的测定》.pdf
  • DIN EN 13193-2000 Packaging - Packaging and environment - Terminology German version EN 13193 2000《包装 包装和环境 术语》.pdf DIN EN 13193-2000 Packaging - Packaging and environment - Terminology German version EN 13193 2000《包装 包装和环境 术语》.pdf
  • DIN EN 13194-2015 Chemicals used for treatment of water intended for human consumption - Acetic Acid German version EN 13194 2015《人类生活用水的处理用化学试剂 乙酸 德文版本EN 13194-2015》.pdf DIN EN 13194-2015 Chemicals used for treatment of water intended for human consumption - Acetic Acid German version EN 13194 2015《人类生活用水的处理用化学试剂 乙酸 德文版本EN 13194-2015》.pdf
  • DIN EN 13195-2013 Aluminium and aluminium alloys - Specifications for wrought and cast products for marine applications (shipbuilding marine and offshore) German version EN 13195 2.pdf DIN EN 13195-2013 Aluminium and aluminium alloys - Specifications for wrought and cast products for marine applications (shipbuilding marine and offshore) German version EN 13195 2.pdf
  • DIN EN 13196-2000 Fruit and vegetable juices - Determination of total sulfur dioxide by destillation German version EN 13196 2000《果汁和蔬菜汁 蒸馏法测定二氧化硫总含量》.pdf DIN EN 13196-2000 Fruit and vegetable juices - Determination of total sulfur dioxide by destillation German version EN 13196 2000《果汁和蔬菜汁 蒸馏法测定二氧化硫总含量》.pdf
  • DIN EN 13197-2014 Road marking materials - Wear simulator Turntable German version EN 13197 2011+A1 2014《路标材料 磨损仿真转台》.pdf DIN EN 13197-2014 Road marking materials - Wear simulator Turntable German version EN 13197 2011+A1 2014《路标材料 磨损仿真转台》.pdf
  • 相关搜索

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

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