[计算机类试卷]国家二级C++机试(操作题)模拟试卷468及答案与解析.doc
《[计算机类试卷]国家二级C++机试(操作题)模拟试卷468及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级C++机试(操作题)模拟试卷468及答案与解析.doc(9页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级 C+机试(操作题)模拟试卷 468及答案与解析 一、基本操作题 1 请使用 VC6或使用【答题】菜单打开考生文件夹 proj1下的工程 proj1,此工程中含有一个源程序文件 proj1 cpp。其中位于每个注释 “ERROR*found*”之后的一行语句存在错误。请改正这些错误,使程序的输出结果为: Constructor called The vallie is 10 Max number is 20 Destructor called 注 意:只能修改注释 “ ERROR*found*”的下一行语句,不要改动程序中的其他内容。 proj1 cpp #include using
2、namespace std; class MyClass public: ERROR *found* void NyClass(int i) value=i; couty?x: y; 求两个整数的最大值 ERROR*found* int Nax(int x, int y, int z=0) 求三个整数的最大值 if(xy) return xz?x: z; else return yz?y: z; int GetValueconstreturn value; NyClass()tout #include using namespace std; 平面坐标中的点 本题坐标系统中, x轴的正方向水平
3、向右, y轴的正方向竖直向下。 Class Point public: Point(double x=0 0, double y=0 0): x_(x), y_(y) double getX()constreturnx; double getY()constreturny_; void setX(double x)x=x; void setY(double y)y=y; private: double x; x坐标 double y; y坐标 ; 矩形 class Rectangle public: Rectangle(Point p, int w, int h) : point(P), wi
4、dth(w), height(h) double area()const矩形面积 return width水 height; Point topLeft()const 左上角顶点 return point; Point bottomRight()const 右下角顶点 (注: y轴正方向竖直向下 ) *found* return Point(_); private: Point point;左上角顶点 double width;水平边长度 double height;垂直边长度 ; 圆形 class Cirole public: Circle(Point p, double r): cente
5、r(p), radius(r) Rectangle boundingBox ( ) const; 外切矩形 double area() consL圆形面积 *found* return PI*_; public: static const double PI;圆周率 private: Point center; 圆心 double radius; 半径 ; const double Circle: P3=3 14159; Rectangle Circle: boundingBox ()const *found* Point pt(_); int w, h; *found* w=h=_; ret
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 机试 操作 模拟 468 答案 解析 DOC
