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

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

1、国家二级 C+机试(操作题)模拟试卷 428及答案与解析 一、基本操作题 1 使用 VC6打开考生文件夹下的源程序文件 modil cpp,该程序运行时有错,请改正其中的错误,使程序正常运行,并使程序输出的结果为: Max is 7 提示: max()数实现找出两个数中的最大值,并作为函数值返回。 注意:错误的语句在 *error*的下面,修改该语句即可。 #include using namespace std; *error* int max(int a, int b) if(a #define N 10 void sort(int AN, int n) int main() int AN

2、5, 7, 4, 6, 10, 13, 78, 4, 9, 20; sort(A, 10); for(int i=0; i *1* #define FALSE 0 *2* Class A2 private: bool m_A2; friend bool func(A2&obj1, A1&obj2); public: A2() m_A2=FALSE; public: void setA2(bool n) m_A2=n; ; class A1 private: bool m A1; *3* public: A1() m_A1=TRUE; public: void setA1(bool n) m_

3、A1=n; ; bool func(A2&obj1, A1&obj2) *4* return int main() A2 obj0; A1 obj1; cout: ”,故第 2个标识下应添加 “class A1; ”。 (3)友元不是本类的成员函数,在它的函数体内部可以通过对象名来访问类的私有成员和保护成员。友元函数是在类声明中由关键字。 friend修饰的非成员函数, 3出添加语句: “friend bool func(A2&obj1, A1&obj2); ”。函数 func返回变量m_A2和 m_A1的逻辑与运算结果,因此第 4标识下应改为 “return obj1 m_A2=TRUE&obj2 m_A1=TRUE; ”。

展开阅读全文
相关资源
猜你喜欢
  • AECMA PREN 2073-1977 Aluminium 1050 A - H14 (AL-P99 5 - H14) Tubes for Structures 5 mm Less Than or Equal to D Less Than or Equal to 100 mm 0 4 mm Less Than or Equal to a Less Than.pdf AECMA PREN 2073-1977 Aluminium 1050 A - H14 (AL-P99 5 - H14) Tubes for Structures 5 mm Less Than or Equal to D Less Than or Equal to 100 mm 0 4 mm Less Than or Equal to a Less Than.pdf
  • AECMA PREN 2076-1-1987 Aerospace Series Aluminium and Magnesium Alloy Ingots and Castings - Technical Specification - Part 1 - General Requirements Edition 1《航空航天系列.铝和镁合金铸锭和铸件 技术规范.pdf AECMA PREN 2076-1-1987 Aerospace Series Aluminium and Magnesium Alloy Ingots and Castings - Technical Specification - Part 1 - General Requirements Edition 1《航空航天系列.铝和镁合金铸锭和铸件 技术规范.pdf
  • AECMA PREN 2076-2-1987 Aerospace Series Aluminium and Magnesium Alloy Ingots and Castings - Technical Specification - Part 2 - Ingots for Remelting Edition 1《航空航天系列.铝和镁合金铸锭和铸件 技术规范.pdf AECMA PREN 2076-2-1987 Aerospace Series Aluminium and Magnesium Alloy Ingots and Castings - Technical Specification - Part 2 - Ingots for Remelting Edition 1《航空航天系列.铝和镁合金铸锭和铸件 技术规范.pdf
  • AECMA PREN 2076-3-1987 Aerospace Series Aluminium and Magnesium Alloy Ingots and Castings - Technical Specification - Part 3 - Pre-Production and Production Castings Edition 1《航空和航.pdf AECMA PREN 2076-3-1987 Aerospace Series Aluminium and Magnesium Alloy Ingots and Castings - Technical Specification - Part 3 - Pre-Production and Production Castings Edition 1《航空和航.pdf
  • AECMA PREN 2078-1997 Aerospace Series Metallic Materials Manufacturing Schedule Inspection Schedule Inspection and Test Report Definition General Principles Preparation and Approva.pdf AECMA PREN 2078-1997 Aerospace Series Metallic Materials Manufacturing Schedule Inspection Schedule Inspection and Test Report Definition General Principles Preparation and Approva.pdf
  • AECMA PREN 2079-1986 Aerospace Series Bearings Precision Ball in Corrosion Resisting Steel for Instruments and Equipments with Flange Dimensions and Loads Issue P 1《航空航天系列.耐腐蚀钢制仪器和.pdf AECMA PREN 2079-1986 Aerospace Series Bearings Precision Ball in Corrosion Resisting Steel for Instruments and Equipments with Flange Dimensions and Loads Issue P 1《航空航天系列.耐腐蚀钢制仪器和.pdf
  • AECMA PREN 2080-1985 Aerospace Series Flexible Wire Ropes for Aircraft Controls in Corrosion Resisting Steel - Construction - Dimensions - Loads Edition 2《航天航空飞机控制装置的预成形可弯曲钢丝绳建筑尺寸承.pdf AECMA PREN 2080-1985 Aerospace Series Flexible Wire Ropes for Aircraft Controls in Corrosion Resisting Steel - Construction - Dimensions - Loads Edition 2《航天航空飞机控制装置的预成形可弯曲钢丝绳建筑尺寸承.pdf
  • AECMA PREN 2081-1977 Non-Metallic Bodied Pulleys with Ball Bearings - for Control Cables Dimensions and Loads Aerospace Series Edition 1《航空航天系列.非金属嵌件球轴承控制电缆尺寸和负重.第1版》.pdf AECMA PREN 2081-1977 Non-Metallic Bodied Pulleys with Ball Bearings - for Control Cables Dimensions and Loads Aerospace Series Edition 1《航空航天系列.非金属嵌件球轴承控制电缆尺寸和负重.第1版》.pdf
  • AECMA PREN 2082-1-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 1 - General Requirements Edition 1《航空航天系列.铝合金锻坯和锻件 技术规范.第1部分 一般要.pdf AECMA PREN 2082-1-1986 Aerospace Series Aluminium Alloy Forging Stock and Forgings - Technical Specification - Part 1 - General Requirements Edition 1《航空航天系列.铝合金锻坯和锻件 技术规范.第1部分 一般要.pdf
  • 相关搜索

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

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