版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、。裝。訂。線。2008 年2009 年第二學(xué)期 面象程序設(shè)計(雙語)期末試題A 卷計科 081-2 班時間共 120 分鐘說明:盡量用英文答題,用中文答題酌情扣分一、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 (動態(tài)變量). 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()/代碼略,功能是在屏幕上輸出學(xué)生的學(xué)號、/其他函數(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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 《重型商用車輛燃料消耗量測量方法gbt+27840-2021》詳細解讀
- 《道路車輛+制動襯片摩擦材料+縮比臺架試驗方法gbt+41663-2022》詳細解讀
- 20XX學(xué)年度一年級美術(shù)下冊計劃教案浙美版新
- 浙美版小學(xué)美術(shù)二年級上冊教案全冊
- 小學(xué)“青藍工程”實施方案
- 實習(xí)學(xué)生自我鑒定
- 2023年全國職業(yè)院校技能大賽中等職業(yè)教育化工生產(chǎn)技術(shù)(ZZ010)練習(xí)試卷附答案
- 市政管涵基坑工程技術(shù)規(guī)程
- Premiere短視頻制作第11章
- Premiere短視頻制作第10章
- 網(wǎng)絡(luò)游戲平臺開發(fā)及運營合作協(xié)議
- 2024新湘教版初中七年級數(shù)學(xué)上冊第四章圖形的認識大單元整體教學(xué)設(shè)計
- 學(xué)習(xí)領(lǐng)悟在全國民族團結(jié)進步表彰大會上重要講話心得體會
- 《寧夏閩寧鎮(zhèn):昔日干沙灘今日金沙灘》教案 2023-2024學(xué)年高教版(2023)中職語文職業(yè)模塊
- 貓砂產(chǎn)品市場需求分析報告
- 紅薯種植課程設(shè)計
- 《我為學(xué)校出點力》(教學(xué)設(shè)計+學(xué)習(xí)任務(wù)單)-道德與法治2024-2025學(xué)年三年級上冊統(tǒng)編版
- 2020-2024年高考地理復(fù)習(xí)試題分類匯編:地質(zhì)地貌(北京專用)(解析版)
- 2024至2030年中國功率電感行業(yè)市場現(xiàn)狀調(diào)研及發(fā)展趨勢預(yù)測研究報告
- 天燃氣工程管道施工組織設(shè)計及方案2
- 綜合實踐項目 制作細胞模型(課件) 2024-2025學(xué)年七年級生物上學(xué)期同步課件(2024人教版)
評論
0/150
提交評論