【计算机类职业资格】计算机二级(C++)上机考试15及答案解析.doc

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

1、计算机二级(C+)上机考试 15 及答案解析(总分:-3.00,做题时间:90 分钟)1.改错题 使用 VC6 打开考生文件夹下的工程 test9_1,此工程包含一个源程序文件 test9_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: 4,5 20 源程序文件 test9_1.cpp 清单如下: #include class A protected: int n,m; public: void set(int a,int b)m=a; n=b; void show()coutenglish; coutcomputer; void Student:computesu

2、m() total=english+computer; cout=1e-6); return x1; )解析:解答本题的关键之处在于看清题中所给的“迭代步骤“,同时要理解 xn+1=cosxn 通式的含义,要考虑到 x1 的初值为 0.0。注意:fabs()函数的功能是用来求某数的绝对值,用时要进行文件包含#include 。 3.综合应用题 使用 VC6 打开考生文件夹下的工程 test6_3,此工程包含一个源程序文件 test6_3.cpp,其中定义了用于表示考生的类 Student,请按要求完成下列操作,将程序补充完整。 (1)定义私有数据成员 code、english 分别用于表示考生

3、的编号、英语成绩、它们都是 int 型的数据。请在注释“/*1*“之后添加适当的语句。 (2)完成成员函数 void Student:inputinformation()的定义,该函数用于用户输入一个考生对象的信息,输入格式如下所示: 输入编号: 英语成绩: 计算机成绩: 请在注释“/*2*“之后添加适当的语句。 (3)利用已实现的类 Student 的成员函数,完成函数 void firstname(Student *A,int num)的定义,该函数根据考生信息 A,输出 num 个考生中总分最高者的编号及其相应的总分,在此不考虑总分相同的情况。请在注释“/*3*“之后添加适当的语句。 注

4、意:除在指定位置添加语句之外,请不要改动程序中的其他内容。 源程序文件 test6_3.cpp 清单如下: #include class Student /*1* int computer; int total; public: void getinformation(); void computesum(); int getcode(); int gettotalscore(); Student(); ; void Student:getinformation() /*2* coutenglish; coutcomputer; void Student:computesum() total=english+computer; coutcode; (3) int tempcode,tempsum; tempcode=(*A0).getcode(); )解析:本题是对 C+程序设计的综合考查,其设计类的成员及成员函数的定义与调用,数据的输入输出,for 循环语句,if 条件判断语句等多个知识点,注意(3)中指针数组的使用,指针数组是一组指针,每一个成员都按照指针的操作规则,但是整个访问规则仍然使用数组下标方式,如 A0指的是第一个指针,而* A0是取出第一个指针指向的内容。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 165000-2 Berichtigung 1-1997 Corrigenda to DIN EN 165000-2 1996-11《DIN EN 165000-2 1996-11技术勘误》.pdf DIN EN 165000-2 Berichtigung 1-1997 Corrigenda to DIN EN 165000-2 1996-11《DIN EN 165000-2 1996-11技术勘误》.pdf
  • DIN EN 165000-2-1996 Film and hybrid integrated circuits - Part 2 Internal visual inspection and special tests German version EN 165000-2 1996《薄膜和混合集成电路 第2部分 内部目视检查和特殊试验》.pdf DIN EN 165000-2-1996 Film and hybrid integrated circuits - Part 2 Internal visual inspection and special tests German version EN 165000-2 1996《薄膜和混合集成电路 第2部分 内部目视检查和特殊试验》.pdf
  • DIN EN 165000-3-1996 Film and hybrid integrated circuits - Part 3 Self-audit checklist and report for film and hybrid integrated circuit manufacturers German version EN 165000-3 19.pdf DIN EN 165000-3-1996 Film and hybrid integrated circuits - Part 3 Self-audit checklist and report for film and hybrid integrated circuit manufacturers German version EN 165000-3 19.pdf
  • DIN EN 165000-4-1996 Film and hybrid integrated circuits - Part 4 Customer information product assessment level schedules and blank detail specification German version EN 165000-4 .pdf DIN EN 165000-4-1996 Film and hybrid integrated circuits - Part 4 Customer information product assessment level schedules and blank detail specification German version EN 165000-4 .pdf
  • DIN EN 165000-5-1998 Film and hybrid integrated circuits - Part 5 Procedure for qualification approval German version EN 165000-5 1997《薄膜集成电路和混合集成电路 第5部分 合格认可的程序》.pdf DIN EN 165000-5-1998 Film and hybrid integrated circuits - Part 5 Procedure for qualification approval German version EN 165000-5 1997《薄膜集成电路和混合集成电路 第5部分 合格认可的程序》.pdf
  • DIN EN 16502-2014 Test method for the determination of the degree of soil acidity according to Baumann-Gully German version EN 16502 2014《根据Baumann-Gully测定土壤酸度的试验方法 德文版本EN 16502-20.pdf DIN EN 16502-2014 Test method for the determination of the degree of soil acidity according to Baumann-Gully German version EN 16502 2014《根据Baumann-Gully测定土壤酸度的试验方法 德文版本EN 16502-20.pdf
  • DIN EN 16503-2014 Water quality - Guidance standard on assessing the hydromorphological features of transitional and coastal waters German version EN 16503 2014《水质 过渡和沿海水域水力形态评估指南标.pdf DIN EN 16503-2014 Water quality - Guidance standard on assessing the hydromorphological features of transitional and coastal waters German version EN 16503 2014《水质 过渡和沿海水域水力形态评估指南标.pdf
  • DIN EN 16506-2014 Systems for renovation of drains and sewers - Lining with a rigidly anchored plastics inner layer (RAPL) German version EN 16506 2014《排水管和下水道改造系统 与刚性固定塑料内层 (RAPL).pdf DIN EN 16506-2014 Systems for renovation of drains and sewers - Lining with a rigidly anchored plastics inner layer (RAPL) German version EN 16506 2014《排水管和下水道改造系统 与刚性固定塑料内层 (RAPL).pdf
  • DIN EN 16507-2014 Railway applications - Ground based service - Diesel refuelling equipment German version EN 16507 2014《轨道交通 基于地面的服务 柴油加油设备 德文版本EN 16507-2014》.pdf DIN EN 16507-2014 Railway applications - Ground based service - Diesel refuelling equipment German version EN 16507 2014《轨道交通 基于地面的服务 柴油加油设备 德文版本EN 16507-2014》.pdf
  • 相关搜索

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

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