[计算机类试卷]国家二级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; ”。

展开阅读全文
相关资源
猜你喜欢
  • ASTM A1038-2008 Standard Practice for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《使用超声接触阻抗法的便携式硬度试验的标准实施规程》.pdf ASTM A1038-2008 Standard Practice for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《使用超声接触阻抗法的便携式硬度试验的标准实施规程》.pdf
  • ASTM A1038-2010 Standard Practice for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《用超声波接触阻抗法进行便携式硬度检验的标准实施规程》.pdf ASTM A1038-2010 Standard Practice for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《用超声波接触阻抗法进行便携式硬度检验的标准实施规程》.pdf
  • ASTM A1038-2010a Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《用超声波接触阻抗法进行便携式硬度测试的标准试验方法》.pdf ASTM A1038-2010a Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《用超声波接触阻抗法进行便携式硬度测试的标准试验方法》.pdf
  • ASTM A1038-2013 Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《用超声波接触阻抗法进行便携式硬度测试的标准试验方法》.pdf ASTM A1038-2013 Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《用超声波接触阻抗法进行便携式硬度测试的标准试验方法》.pdf
  • ASTM A1038-2013e1 Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《采用超声波接触阻抗法进行便携式硬度试验的标准试验方法》.pdf ASTM A1038-2013e1 Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《采用超声波接触阻抗法进行便携式硬度试验的标准试验方法》.pdf
  • ASTM A1038-2017 Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《采用超声波接触阻抗法进行便携式硬度试验的标准试验方法》.pdf ASTM A1038-2017 Standard Test Method for Portable Hardness Testing by the Ultrasonic Contact Impedance Method《采用超声波接触阻抗法进行便携式硬度试验的标准试验方法》.pdf
  • ASTM A1039 A1039M-2004 Standard Specification for Steel Sheet Hot Rolled Carbon Commercial and Structural Produced by the Twin-Roll Casting Process.pdf ASTM A1039 A1039M-2004 Standard Specification for Steel Sheet Hot Rolled Carbon Commercial and Structural Produced by the Twin-Roll Casting Process.pdf
  • ASTM A1039 A1039M-2009 Standard Specification for Steel Sheet Hot Rolled Carbon Commercial Structural and High-Strength Low-Alloy Produced by Twin-Roll Casting Process.pdf ASTM A1039 A1039M-2009 Standard Specification for Steel Sheet Hot Rolled Carbon Commercial Structural and High-Strength Low-Alloy Produced by Twin-Roll Casting Process.pdf
  • ASTM A1039 A1039M-2009a Standard Specification for Steel Sheet Hot Rolled Carbon Commercial Structural and High-Strength Low-Alloy Produced by Twin-Roll Casting Process《用双滚轴铸造法生产的商.pdf ASTM A1039 A1039M-2009a Standard Specification for Steel Sheet Hot Rolled Carbon Commercial Structural and High-Strength Low-Alloy Produced by Twin-Roll Casting Process《用双滚轴铸造法生产的商.pdf
  • 相关搜索

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

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