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

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

1、计算机二级(C+)上机考试 22 及答案解析(总分:-3.00,做题时间:90 分钟)1.改错题 使用 VC6 打开考生文件夹下的工程 test11_1,此工程包含一个源程序文件 test11_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果如下: ch1=7 ch2=9 源程序文件test11_1.cpp 清单如下: #include class Sample /* found */ char ch1,ch2 public: /* found */ friend void set(Sample s, char c1,char c2) s.ch1=c1; s.ch2=c2

2、 void print()coutch; fun(str,ch); cout a b; CPosition psA(a, b); cout a b; cout ch; fun(str,ch); 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 次方。

展开阅读全文
相关资源
猜你喜欢
  • NF C94-232-2-1993 Methods of measurement for radio transmitters Part 12  guidelines for drawing up descriptive leaflets for transmitters and transposers for sound and television br.pdf NF C94-232-2-1993 Methods of measurement for radio transmitters Part 12 guidelines for drawing up descriptive leaflets for transmitters and transposers for sound and television br.pdf
  • NF C94-233-1993 Methods of measurement for radio transmitters Part 13  performance characteristics for fm sound broadcasting 《无线电发射机的测量方法 第13部分 调频声广播的性能特性》.pdf NF C94-233-1993 Methods of measurement for radio transmitters Part 13 performance characteristics for fm sound broadcasting 《无线电发射机的测量方法 第13部分 调频声广播的性能特性》.pdf
  • NF C94-234-1997 Methods of measurement for radio transmitters Part 14  external intermodulation products caused by two or more transmitters using the same or adjacent antennas 《无线电.pdf NF C94-234-1997 Methods of measurement for radio transmitters Part 14 external intermodulation products caused by two or more transmitters using the same or adjacent antennas 《无线电.pdf
  • NF C94-566-1998 Measurement of exposure to radio-frequency electromagnetic fields Field strength in the frequency range 100 kHz to 1 GHz 《射频电磁场暴露测量 频率范围为 100 kHz - 1 GHz 的场强》.pdf NF C94-566-1998 Measurement of exposure to radio-frequency electromagnetic fields Field strength in the frequency range 100 kHz to 1 GHz 《射频电磁场暴露测量 频率范围为 100 kHz - 1 GHz 的场强》.pdf
  • NF C94-864-2-1998 Standardization of interconnections between broadcasting transmitters or transmitter systems and supervisory equipment Part 2  interface standards for systems usi.pdf NF C94-864-2-1998 Standardization of interconnections between broadcasting transmitters or transmitter systems and supervisory equipment Part 2 interface standards for systems usi.pdf
  • NF C96-001-1984 Electronic components Semiconductor devices Discrete devices and integrated circuits Part 1  general 《电子元件 半导体器件 分立元件和集成电路 第1部分 总则》.pdf NF C96-001-1984 Electronic components Semiconductor devices Discrete devices and integrated circuits Part 1 general 《电子元件 半导体器件 分立元件和集成电路 第1部分 总则》.pdf
  • NF C96-002-2001 Semiconductor devices - Discrete devices and integrated circuits - Part 2  rectifier diodes 《半导体器件 分立器件和集成电路 第2部分 整流二极管》.pdf NF C96-002-2001 Semiconductor devices - Discrete devices and integrated circuits - Part 2 rectifier diodes 《半导体器件 分立器件和集成电路 第2部分 整流二极管》.pdf
  • NF C96-003-1986 Semiconductor devices Discrete devices and integrated circuits Part 3  signal (including switching) and regulator diodes 《半导体器件 分立器件和集成电路 第3部分 信号(包括开关)和整流二极管》.pdf NF C96-003-1986 Semiconductor devices Discrete devices and integrated circuits Part 3 signal (including switching) and regulator diodes 《半导体器件 分立器件和集成电路 第3部分 信号(包括开关)和整流二极管》.pdf
  • NF C96-005-1994 Discrete devices and integrated circuits Part 5  optoelectronic devices 《分立器件和集成电路 第5部分 光电器件》.pdf NF C96-005-1994 Discrete devices and integrated circuits Part 5 optoelectronic devices 《分立器件和集成电路 第5部分 光电器件》.pdf
  • 相关搜索

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

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