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

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

1、国家二级 C+机试(操作题)模拟试卷 57及答案与解析 一、基本操作题 1 使用 VC6打开考生文件夹下的源程序文件 modil cpp,请修改程序中的错误,使程序能得出正确的结果: num: 0 num: 1 num: 10 注意:不要改动 main函数,不能增行或删行,也不能更改程序的结构,错误的语句在 *error*的下面。 1 #include 2 int i=10 ; 3 C1ass TestClass 4 5 public: 6 TestClass(int i) 7 8 cout 2 #define MAXNLEN 100 3 void factor(int*des, int&le

2、ngth, int n) 4 5 6 7 void main() 8 9 int aMAXNLEN, length ; 10 int n=20; 11 factor(a, length, n); 12 for(int i=0, i 2 class CMyClass 3 4 public: 5 *1* 6 CMyClass(int i, int j) 7 8 Numberl=i; 9 Number3+=i; 10 1i void display() 12 13 couti=i+1 ;或 TestClasS: i=i+1;或 (*this) i=i+1; (2)TestClass print(0)

3、 (3)couti=i+l; ”或 “TestClass: i=i+1; ”或“(*this) i=i+l; ”。 (3)主函数中通过 “cout: =,因此第 3个标识下应为 “int CMyClass: Number3=4; ”0 (4)成员函数 AddNum()带有一个整型参数,因此调用此函数时必须有参数传入,可由程序运行结果分析得知传入的参数值的大小。在 fun()函数内,定义CMyClass obj(1, 2)后, obj Numberl=l, obj Number2=2,Number3=16+1=17, obj Numberl=4, Number1为 4, obj Number2为常成员其值不会改 变,调用 AddNum0函数后调用显示函数显示成员变量值,可知Number3为 19,因此 AddNum0的参数为 19 17=2,即第 4个标识下应为“obj AddNum(2); ”

展开阅读全文
相关资源
猜你喜欢
  • ANSI UL 681-2014 UL Standard for Safety Installation and Classification of Burglar and Holdup Alarm Systems (Fifteenth Edition)《防盗报警系统的安装和分类的安全性标准》.pdf ANSI UL 681-2014 UL Standard for Safety Installation and Classification of Burglar and Holdup Alarm Systems (Fifteenth Edition)《防盗报警系统的安装和分类的安全性标准》.pdf
  • ANSI UL 687-2011 UL Standard for Safety Burglary-Resistant Safes (Fifteenth Edition Reprint with revisions through and including November 25 2015)《防盗保险箱的安全标准》.pdf ANSI UL 687-2011 UL Standard for Safety Burglary-Resistant Safes (Fifteenth Edition Reprint with revisions through and including November 25 2015)《防盗保险箱的安全标准》.pdf
  • ANSI UL 69-2009 UL Standard for Safety Electric-Fence Controllers (Tenth Edition Reprint with Revisions Through and Including April 20 2018)《电栅栏控制器安全性标准》.pdf ANSI UL 69-2009 UL Standard for Safety Electric-Fence Controllers (Tenth Edition Reprint with Revisions Through and Including April 20 2018)《电栅栏控制器安全性标准》.pdf
  • ANSI UL 696-2010 UL Standard for Safety Electric Toys (Tenth Edition Reprint with Revisions Through and Including April 24 2015)《电动玩具的安全标准》.pdf ANSI UL 696-2010 UL Standard for Safety Electric Toys (Tenth Edition Reprint with Revisions Through and Including April 24 2015)《电动玩具的安全标准》.pdf
  • ANSI UL 697-2011 UL Standard for Safety Toy Transformers (Seventh Edition Reprint with Revisions Through and Including August 17 2016)《玩具变压器安全性标准(提案日期 2010-12-17)》.pdf ANSI UL 697-2011 UL Standard for Safety Toy Transformers (Seventh Edition Reprint with Revisions Through and Including August 17 2016)《玩具变压器安全性标准(提案日期 2010-12-17)》.pdf
  • ANSI UL 698A-2012 UL Standard for Safety Industrial Control Panels Relating to Hazardous (Classified) Locations (Third Edition Reprint with revisions through and including January .pdf ANSI UL 698A-2012 UL Standard for Safety Industrial Control Panels Relating to Hazardous (Classified) Locations (Third Edition Reprint with revisions through and including January .pdf
  • ANSI UL 6A-2008 UL Standard for Safety Electrical Rigid Metal Conduit - Aluminum Red Brass and Stainless Steel (Second Edition Reprint with Revisions Through and Including November.pdf ANSI UL 6A-2008 UL Standard for Safety Electrical Rigid Metal Conduit - Aluminum Red Brass and Stainless Steel (Second Edition Reprint with Revisions Through and Including November.pdf
  • ANSI UL 705-2017 UL Standard for Safety Power Ventilators (Seventh Edition).pdf ANSI UL 705-2017 UL Standard for Safety Power Ventilators (Seventh Edition).pdf
  • ANSI UL 710-2012 UL Standard for Safety Exhaust Hoods for Commercial Cooking Equipment (Sixth Edition Reprint with Revisions Through and Including June 25 2018)《商用烹调设备的排风罩安全标准》.pdf ANSI UL 710-2012 UL Standard for Safety Exhaust Hoods for Commercial Cooking Equipment (Sixth Edition Reprint with Revisions Through and Including June 25 2018)《商用烹调设备的排风罩安全标准》.pdf
  • 相关搜索

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

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