




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、。装。订。线。2008 年2009 年第二学期 面象程序设计(双语)期末试题A 卷计科 081-2 班时间共 120 分钟说明:尽量用英文答题,用中文答题酌情扣分一、Describe conceptions and give exles (每小题 10 分,共 20 分)1.Describe the definition(定义) of Overloading Function Names(重载函数名). Please give anexle.2.Describe the definition of Dynamic Variables (动态变量). Please give an exle to
2、 create adynamic variable of type.得分阅卷人题 号一二三四五六总分得 分阅卷人二、Rerograms, and give the results(每小题 10 分,共 30 分)1. What is the output produced by the following program.#includeusing namespatd;void func(double test)throw ( main()trycoutTrying.n; func(95););coutTryingafter call.n;catch()coutCatching.n;coutE
3、nd of program.n; return 0;void func(double test) throw ()coutStarting function.n; if(test100)throw 42;2. What is the output produced by the following program.#includeusing namespatd;void figure_me_out( main()a,b,c; a=10; b=20; c=30;& x,y,& z);figure_me_out(a,b,c);couta return 0;bc;void figure_me_out
4、(& x,y,& z)coutx x=1;y=2; z=3;coutxyzendl;zendl;得分阅卷人Consider the following code:3.string s1,s2(“o”);couts1;if(s1= =s2) cout”Equaln”;elsecout”Not equaln”;If the dialogue begins as follows, what will be the next line of output?三、Programming (每小题 10 分,共 50 分)1.Write a complete(完整) C+ programt readswo
5、whole numbers of type double andoutputs their sum. Be sure to prompt(提示) for input, echo input, and label all output.得分阅卷人Enter a line of input:o friend!2.Write a definition for a void function called to_screen. The function to_screen has one formal parameter called file_stream, which is of type ifs
6、tream. The precondition(前提条件) andtcondition(后置条件) for the function are as follows:/Precondition: The stream file_stream has been connected to a file with a call to the member/function open. The file contains a list ofegers (and nothing else)./tcondition: The numbershe file connected to file_stream h
7、ave been written to the screenone per line. (This function does not close the file)3.There are two files of text(文本文件): “infile1.txt” and “infile2.txt”. Please concatenate(连接)the contents of the two files to a new file (“infile3.txt”).4. According to the following test program, define and implement
8、a class which can use the following program to test it.#includeusing namespa main()n=6;string s=”td;o”;Exam a(n,s);a.pr();/在屏幕上输出:number=6, words=oreturn 0;5.There is a base class Student as follows:class Studentpublic:Student(string no,string name); Student();void show_infor();protected:string stu_
9、no; string stu_name;void Student:show_infor()/代码略,功能是在屏幕上输出学生的学号、/其他函数实现略 Please give the definition and implemenion for a class Computer_stut is a derived classof Student. The class Computer_stu should have two additional data fields, depart,t is of typestring, and score,t is of type double. The class also should have suitable constructors(构造函数). Redefine the function show_infor to show all of the information of the class. Write a test program to create
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 保证合同范本官网
- 丹巴客栈转让合同范本
- 优化合同范本
- 海南植被垂直绿化施工方案
- 劳动合同保险合同范本
- 出入口智能停车场施工方案
- 1080个常用合同范本
- 第二单元第6课《网络基础》教学设计 2023-2024学年青岛版(2019)初中信息技术第一册
- 到家购房合同范本
- 利用资源合同范本
- 2022年山西省中考物理试题(含答案)
- QC成果:预制扭王字块体表面缺陷控制知识分享
- 光伏强制性条文执行计划(共25页)
- 2021新《安全生产法》全面解读课件(PPT 84页)
- 企业、事业专职消防队训练内容及操作规程
- T∕CCCMHPIE 1.2-2016 植物提取物 槟榔多糖多酚
- 局域网规划设计_毕业论文
- 胫骨平台骨折(课堂PPT)
- 欧洲文化入门王精品PPT课件
- 中考复习复分解反应类型方程式书写训练题(无答案)
- 病理学课程标准
评论
0/150
提交评论