[计算机类试卷]国家二级C++机试(操作题)模拟试卷350及答案与解析.doc

上传人:testyield361 文档编号:497433 上传时间:2018-11-28 格式:DOC 页数:7 大小:33.50KB
下载 相关 举报
[计算机类试卷]国家二级C++机试(操作题)模拟试卷350及答案与解析.doc_第1页
第1页 / 共7页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷350及答案与解析.doc_第2页
第2页 / 共7页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷350及答案与解析.doc_第3页
第3页 / 共7页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷350及答案与解析.doc_第4页
第4页 / 共7页
[计算机类试卷]国家二级C++机试(操作题)模拟试卷350及答案与解析.doc_第5页
第5页 / 共7页
点击查看更多>>
资源描述

1、国家二级 C+机试(操作题)模拟试卷 350及答案与解析 一、基本操作题 1 使用 VC6打开考生文件夹下的源程序文件 modi1 cpp,该程序运行时有错,请改正其中的错误,使程序正常运行,输出的结果为: Constructor,i=0, Destructor 注意:错误的语句在 *error*的下面,修改该语句即可。 #include class cobj int i; public: cobj(); void display(); cobj(); ; *error* cobj: cobj() cout void show() void main() cout #include #defi

2、ne PI 3 1415926 clas S CMyPoint public: int x, y; CMyPoint(int tx, int ty): X(tx), Y(ty)f ; class CMyShape public: CMyShape()coutGetArea() GetGirth()GetArea() GetGirth()0; i一一 ) for(int j=1; j=i; j+) coutj*i=i*j; coutend1; 【试题解析】 本题属于输出图形题,输出图形呈规律变化,横向看乘号前的数字逐渐增大,竖向看乘号后的数字逐渐减小,可以用循环来实现,一重循环只能控制一个方向,

3、因此可用二重循环来输出该图形。 三、综 合应用题 3 【正确答案】 (1)添加语句: virtual double GetArea()=0; (2)添加语句: virtual double GetGirth()=0; (3)添加语句: myshape=mycircle; (4)添加语句: myshape=myRectanqle; 【试题解析】 类 CMyPoint含有成员变量 x和 y,抽象基类 CMyShape含有两个虚函数 GetArea0和 GetGirth0,分别用来求图形的面积和周长。类CMyRectangle和类 CMyCircle派生于类 CMyShape,并都实现了抽象父类的纯虚函数,通过这两个函数可分别求得矩形的面积和周长以及圆的面积和周长。

展开阅读全文
相关资源
猜你喜欢
  • ASTM C1453-2000(2006) Standard Test Method for the Determination of Uranium by Ignition and the Oxygen to Uranium (O U) Atomic Ratio of Nuclear Grade Uranium Dioxide Powders and Pe.pdf ASTM C1453-2000(2006) Standard Test Method for the Determination of Uranium by Ignition and the Oxygen to Uranium (O U) Atomic Ratio of Nuclear Grade Uranium Dioxide Powders and Pe.pdf
  • ASTM C1453-2000(2011) Standard Test Method for the Determination of Uranium by Ignition and the Oxygen to Uranium (O U) Atomic Ratio of Nuclear Grade Uranium Dioxide Powders and Pe.pdf ASTM C1453-2000(2011) Standard Test Method for the Determination of Uranium by Ignition and the Oxygen to Uranium (O U) Atomic Ratio of Nuclear Grade Uranium Dioxide Powders and Pe.pdf
  • ASTM C1455-2007 Standard Test Method for Nondestructive Assay of Special Nuclear Material Holdup Using Gamma-Ray Spectroscopic Methods《用Υ射线光谱法对特殊核物质含量无损分析的标准试验方法》.pdf ASTM C1455-2007 Standard Test Method for Nondestructive Assay of Special Nuclear Material Holdup Using Gamma-Ray Spectroscopic Methods《用Υ射线光谱法对特殊核物质含量无损分析的标准试验方法》.pdf
  • ASTM C1455-2014 Standard Test Method for Nondestructive Assay of Special Nuclear Material Holdup Using Gamma-Ray Spectroscopic Methods《用γ射线光谱法对特殊核物质含量无损分析的标准试验方法》.pdf ASTM C1455-2014 Standard Test Method for Nondestructive Assay of Special Nuclear Material Holdup Using Gamma-Ray Spectroscopic Methods《用γ射线光谱法对特殊核物质含量无损分析的标准试验方法》.pdf
  • ASTM C1455-2014e1 Standard Test Method for Nondestructive Assay of Special Nuclear Material Holdup Using Gamma-Ray Spectroscopic Methods《采用伽马射线光谱法对特种核材料的滞留量进行无损分析的标准试验方法》.pdf ASTM C1455-2014e1 Standard Test Method for Nondestructive Assay of Special Nuclear Material Holdup Using Gamma-Ray Spectroscopic Methods《采用伽马射线光谱法对特种核材料的滞留量进行无损分析的标准试验方法》.pdf
  • ASTM C1456-2000 Standard Test Method for the Determination of Uranium or Gadolinium or Both in Gadolinium Oxide-Uranium Oxide Pellets or by X-Ray Fluorescence (XRF)《用X射线荧光法测定氧化钆和氧化.pdf ASTM C1456-2000 Standard Test Method for the Determination of Uranium or Gadolinium or Both in Gadolinium Oxide-Uranium Oxide Pellets or by X-Ray Fluorescence (XRF)《用X射线荧光法测定氧化钆和氧化.pdf
  • ASTM C1456-2008 Standard Test Method for the Determination of Uranium or Gadolinium or Both in Gadolinium Oxide-Uranium Oxide Pellets or by X-Ray Fluorescence (XRF)《用X射线荧光法(XRF)测定氧.pdf ASTM C1456-2008 Standard Test Method for the Determination of Uranium or Gadolinium or Both in Gadolinium Oxide-Uranium Oxide Pellets or by X-Ray Fluorescence (XRF)《用X射线荧光法(XRF)测定氧.pdf
  • ASTM C1456-2013 Standard Test Method for Determination of Uranium or Gadolinium (or both) in Gadolinium Oxide-Uranium Oxide Pellets or by X-Ray Fluorescence (XRF)《用X射线荧光法(XRF)测定氧化钆.pdf ASTM C1456-2013 Standard Test Method for Determination of Uranium or Gadolinium (or both) in Gadolinium Oxide-Uranium Oxide Pellets or by X-Ray Fluorescence (XRF)《用X射线荧光法(XRF)测定氧化钆.pdf
  • ASTM C1457-2000(2005) Standard Test Method for the Determination of Total Hydrogen Content of Uranium Oxide Powders and Pellets by Carrier Gas Extraction《用载气萃取法测定二氧化铀粉末或颗粒中氢的总含量的标准.pdf ASTM C1457-2000(2005) Standard Test Method for the Determination of Total Hydrogen Content of Uranium Oxide Powders and Pellets by Carrier Gas Extraction《用载气萃取法测定二氧化铀粉末或颗粒中氢的总含量的标准.pdf
  • 相关搜索

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

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