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

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

1、计算机二级(C+)上机考试 3及答案解析(总分:-3.00,做题时间:90 分钟)1.改错题 使用 VC6打开考生文件夹下的工程 test19_1,此工程包含一个源程序文件 test19_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下: 1: weight:5 age:0 2: weight:7 age:9源程序文件 test19_1.cpp清单如下: #include class animal public: /* found */ friend void setvalue(animal /* found */ viod print(); protected: in

2、t itsweight; int itsage; ; void animal:print() cout a b; CPosition psA(a, b); cout a b; cout y) t=x; x=y; y=t; coutz) t=x; x=z; z=t; if(yz) t=y; y=z; z=t; cout a b; CPosition psA(a, b); cout a b; cout “The distance is “ psA.distance(a,b) _正确答案:((1) CPosition:CPosition() (2) void move(double ax, double ay)x += ax;y += ay; (3) return sqrt(pow(x-bx, 2) + pow(y-by, 2); )解析:本题主要考查考生对于类的定义和重载构造函数的掌握情况。在(3)中使用了基本的数学函数sqrt(x)求 x的开方,pow(x,n)函数是求 x的 n次方。

展开阅读全文
相关资源
猜你喜欢
  • SN T 2360 2-2009 Rules for the inspection of food additives for import and export Part 2 Acidity regulator《进出口食品添加剂检验规程 第2部分 酸度调节剂》.pdf SN T 2360 2-2009 Rules for the inspection of food additives for import and export Part 2 Acidity regulator《进出口食品添加剂检验规程 第2部分 酸度调节剂》.pdf
  • SN T 2360 20-2009 Rules for the inspection of food additives for import and export Part 20 Sweeteners《进出口食品添加剂检验规程 第20部分 甜味剂》.pdf SN T 2360 20-2009 Rules for the inspection of food additives for import and export Part 20 Sweeteners《进出口食品添加剂检验规程 第20部分 甜味剂》.pdf
  • SN T 2360 21-2009 Rules for the inspection of food additives for import and export Part 21 Thickener《进出口食品添加剂检验规程 第21部分 增稠剂》.pdf SN T 2360 21-2009 Rules for the inspection of food additives for import and export Part 21 Thickener《进出口食品添加剂检验规程 第21部分 增稠剂》.pdf
  • SN T 2360 22-2009 Rules for the inspection of food additives for import and export Part 22 Flavor substances and flavorings《进出口食品添加剂检验规程 第22部分 香料香精》.pdf SN T 2360 22-2009 Rules for the inspection of food additives for import and export Part 22 Flavor substances and flavorings《进出口食品添加剂检验规程 第22部分 香料香精》.pdf
  • SN T 2360 23-2009 Rules for the inspection of food additives for import and export Part 23 Composit food additives《进出口食品添加剂检验规程 第23部分 复合食品添加剂》.pdf SN T 2360 23-2009 Rules for the inspection of food additives for import and export Part 23 Composit food additives《进出口食品添加剂检验规程 第23部分 复合食品添加剂》.pdf
  • SN T 2360 24-2009 Rules for the inspection of food additives for import and export Part 24 Special food additives《进出口食品添加剂检验规程 第24部分 特定用途食品添加剂》.pdf SN T 2360 24-2009 Rules for the inspection of food additives for import and export Part 24 Special food additives《进出口食品添加剂检验规程 第24部分 特定用途食品添加剂》.pdf
  • SN T 2360 25-2009 Rules for the inspection of food additives for import and export Part 25 Food processing aids《进出口食品添加剂检验规程 第25部分 食品工业用加工助剂》.pdf SN T 2360 25-2009 Rules for the inspection of food additives for import and export Part 25 Food processing aids《进出口食品添加剂检验规程 第25部分 食品工业用加工助剂》.pdf
  • SN T 2360 3-2009 Rules for the inspection of food additives for import and export Part 3 Anticaking agent《进出口食品添加剂检验规程 第3部分 抗结剂》.pdf SN T 2360 3-2009 Rules for the inspection of food additives for import and export Part 3 Anticaking agent《进出口食品添加剂检验规程 第3部分 抗结剂》.pdf
  • SN T 2360 4-2009 Rules for the inspection of food additives for import and export Part 4 Antifoaming agents《进出口食品添加剂检验规程 第4部分 消泡剂》.pdf SN T 2360 4-2009 Rules for the inspection of food additives for import and export Part 4 Antifoaming agents《进出口食品添加剂检验规程 第4部分 消泡剂》.pdf
  • 相关搜索

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

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