[计算机类试卷]国家二级C++机试(操作题)模拟试卷329及答案与解析.doc
《[计算机类试卷]国家二级C++机试(操作题)模拟试卷329及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级C++机试(操作题)模拟试卷329及答案与解析.doc(8页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级 C+机试(操作题)模拟试卷 329及答案与解析 一、基本操作题 1 使用 VC6打开考生文件夹 projl下的工程 pmjl,其中有 “沙发 ”类 Sofa和主函数main的定义。程序中位于每个, ERROR*found*下的语句行有错误,请加以更正。更正后程序的输出应该是: 座位数: 3 颜色:红色 注意:只能修改每爪 ERROR*found*下的那一行,不要改动程序中的其他内容。 #include us ing namespace std; class Sofa “沙发 ”类 int seats; 座位数 char color10;颜色 public: ERROR*found*
2、Sofa(int S, const char*CO) ERROR*found* if(CO=NULL) color0= 0; elSe strcpy(color, CO); ERROR*found* const char*getSeats()constreturn seats; ) const chars getColor()constreturn color; ) ; int main() Sofa safa(3); cout #include #include using namespace std; class AutoMobile “汽车 ”类 char*brand; 汽车品牌 cha
3、r*number; 车牌号 int speed; 档位: 1、 2、 3、 4、 5,空档: 0, 倒档:一 1 public: AutoMobile(const char*the brand, const char*the_number): speed(0) brand=new charstrlen(the brand)+1 ; *found* _; *found* _; strcpy(number, the number); AutoMobile()deletebrand; deletenumber; ) const char*theBrand()constreturn brand; 返回
4、品牌名称 const char*theNumber()constreturn number; ) 返回车牌号 int currentSpeed()const return speed; 返回当前档位 void changeGearTo(int the_speed) 换到指定档位 if(speed=一 1 speed #include using namespace std; class CDeepCopy public: int n; 动态数组的元素个数 int *p; 动态数组首地址 CDeepCopy(int); CDeepCopy(); CDeepCopy ) 【试题解析】 程序定义 S
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 机试 操作 模拟 329 答案 解析 DOC
