版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、。裝。訂。線。2008 年2009 年第二學(xué)期 面象程序設(shè)計(jì)(雙語(yǔ))期末試題A 卷計(jì)科 081-2 班時(shí)間共 120 分鐘說(shuō)明:盡量用英文答題,用中文答題酌情扣分一、Describe conceptions and give exles (每小題 10 分,共 20 分)1.Describe the definition(定義) of Overloading Function Names(重載函數(shù)名). Please give anexle.2.Describe the definition of Dynamic Variables (動(dòng)態(tài)變量). Please give an exle to
2、 create adynamic variable of type.得分閱卷人題 號(hào)一二三四五六總分得 分閱卷人二、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()/代碼略,功能是在屏幕上輸出學(xué)生的學(xué)號(hào)、/其他函數(shù)實(shí)現(xiàn)略 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(構(gòu)造函數(shù)). Redefine the function show_infor to show all of the information of the class. Write a test program to create
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 制藥菌種培育工誠(chéng)信測(cè)試考核試卷含答案
- 園林植保工崗前操作評(píng)估考核試卷含答案
- 草食家畜飼養(yǎng)工安全文明考核試卷含答案
- 印刷設(shè)備電氣裝調(diào)工變更管理競(jìng)賽考核試卷含答案
- 高頻電感器制造工安全管理評(píng)優(yōu)考核試卷含答案
- 化學(xué)氧化工安全專項(xiàng)知識(shí)考核試卷含答案
- 細(xì)紗機(jī)操作工創(chuàng)新實(shí)踐模擬考核試卷含答案
- 尾礦工成果轉(zhuǎn)化競(jìng)賽考核試卷含答案
- 電子設(shè)備裝接工班組建設(shè)水平考核試卷含答案
- 熱浸鍍工安全風(fēng)險(xiǎn)競(jìng)賽考核試卷含答案
- 2026院感知識(shí)考試題及答案
- 《紅樓夢(mèng)》導(dǎo)讀 (教學(xué)課件) -高中語(yǔ)文人教統(tǒng)編版必修下冊(cè)
- 安徽省九師聯(lián)盟2025-2026學(xué)年高三(1月)第五次質(zhì)量檢測(cè)英語(yǔ)(含答案)
- (2025年)四川省自貢市紀(jì)委監(jiān)委公開遴選公務(wù)員筆試試題及答案解析
- 2025年度骨科護(hù)理部年終工作總結(jié)及工作計(jì)劃
- 2026安徽省農(nóng)村信用社聯(lián)合社面向社會(huì)招聘農(nóng)商銀行高級(jí)管理人員參考考試試題及答案解析
- 室外供熱管道安裝監(jiān)理實(shí)施細(xì)則
- 巖板采購(gòu)合同范本
- 通信管道施工質(zhì)量管理流程解析
- 商場(chǎng)經(jīng)理2025年終工作總結(jié)(二篇)
- popchrio歐可芮小紅書營(yíng)銷方案
評(píng)論
0/150
提交評(píng)論