[计算机类试卷]国家二级C++机试(操作题)模拟试卷477及答案与解析.doc
《[计算机类试卷]国家二级C++机试(操作题)模拟试卷477及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级C++机试(操作题)模拟试卷477及答案与解析.doc(8页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级 C+机试(操作题)模拟试卷 477及答案与解析 一、基本操作题 1 请使用 VC6或使用【答题】菜单打开考生文件夹 proj1下的工程 proj1,其中在编辑窗口内显示的主程序文件中定义有类 ABC和主函数 main。程序文本中位于每行 “ ERROR*found*”之后的一行语句有错误,请加以改正。改正后程序的输出结果应该是: 21 23 注意:只修改每个 “ ERROR*found*”下面的一行,不要改动程序中的其他任何内容。 #include using namespace std; class ABC public: ERROR *found* ABC()a=0; b=0;
2、C=0; ABC(int aa, int bb, int cc; void Setab()+a, +b; int Sum()return a+b+c; private: int a, b; const int c; ; ABC: ABC(int aa, int bb, int cc): c(cc)a=aa; b=bb; int main() ABC x(1, 2, 3), y(4, 5, 6); ABC z, *w=&z; w-Setab(); ERROR *found* int s1=x Sum()+y-Sum(); cout using namespace std; class Room
3、“房间 ”类 int room no; 房间号 double length; 房间长度 (m) double width; 房间宽度 (m) public: Room(int the_room_no, double the_length, double the_width): room_no(the_room_no), length (the_length), width(the_width) int theRoomNo()constreturn room_no; 返回房间号 double theLength()constreturn length; )返回房间长度 double theWid
4、th()constreturn width; )返回房间宽度 *found* double theArea()const_返回房间面积 (矩形面积 ) ; class Office: public Room “办公室 ”类 char*depart;所属部门 public: Office(int the room no, double the_length, double the_width, const char *the depart) *found* : _ depart=new charstrlen(the depart)+1; *found* strcpy(_); Office()de
5、lete depart; const char*theDepartment() constreturn depart; 返回所属部门 ; int main() *found* Office_; coutA- # A- # A- # exiting inner block exiting outer block 注意:只在函数 Prepend的 “ *333*”和 “*666*”之间填入若干语句,不要改动程序中的其他内容。 sList h Struer sListItem char data; sListItem*next; ; class sList public: sList(): h(0)
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 机试 操作 模拟 477 答案 解析 DOC
