[计算机类试卷]国家二级C++机试(操作题)模拟试卷112及答案与解析.doc
《[计算机类试卷]国家二级C++机试(操作题)模拟试卷112及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级C++机试(操作题)模拟试卷112及答案与解析.doc(7页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级 C+机试(操作题)模拟试卷 112及答案与解析 一、基本操作题 1 使用 VC6打开考生文件夹下的源程序文件 modil epp,但该程序运行有问题,请改正 main函数中的错误,使程序的输出结果是: nember=l nember=10 nember: 100 注意:不要改动 main函数,不能增行或删行,也不能更改程序的结构,错误的语句在 *error*的下面。 #lnclude C1ass TeStClass public: TestClass(int i) nember=i; void SetNember(int m) nember=m; int GetNember()con
2、st( return nember; void Print()const cout #include #include using namespace std ; void WriteFile(int c) ofstream outl ; outl open(”modi2 txt”, ios base: binary I losbase: app); outl C1ass CHumanInf0 private: int height; int weight; *1* public: *2* : height(ht), weight(wt), bloodType(bt); CHumanInfo(
3、CHumanlnfo int GetHeight() return height; int GetWeight() return weight; int GetBloodType() return bloodType; void SetInfo(int ht, int wt, char bt); void Display(); ); *3* height=ht; weight=wt ; bloodType=bt; void CHumanInfo: Display() cout: (),故第 3个标识下应添加“voidCHumanlnfo: Setlnfo(int ht, int wt, char bt)”。 (4)调用函数 Setlnf00需要 3个参数,程序要求把对象 d2的三个私有数据成员分别设定为身高 170,体重 64,血型为 B,即把这三个值传入函数 SetlnfoO,因此第 4个标识下应添加 “h2 Setlnfo(170, 64, B); ”0
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 机试 操作 模拟 112 答案 解析 DOC
