![08092面向?qū)ο蟪绦蛟O(shè)計雙語卷答案計科081_第1頁](http://file4.renrendoc.com/view/3e92c94b0a2633f5f045b476af9363b9/3e92c94b0a2633f5f045b476af9363b91.gif)
![08092面向?qū)ο蟪绦蛟O(shè)計雙語卷答案計科081_第2頁](http://file4.renrendoc.com/view/3e92c94b0a2633f5f045b476af9363b9/3e92c94b0a2633f5f045b476af9363b92.gif)
![08092面向?qū)ο蟪绦蛟O(shè)計雙語卷答案計科081_第3頁](http://file4.renrendoc.com/view/3e92c94b0a2633f5f045b476af9363b9/3e92c94b0a2633f5f045b476af9363b93.gif)
![08092面向?qū)ο蟪绦蛟O(shè)計雙語卷答案計科081_第4頁](http://file4.renrendoc.com/view/3e92c94b0a2633f5f045b476af9363b9/3e92c94b0a2633f5f045b476af9363b94.gif)
![08092面向?qū)ο蟪绦蛟O(shè)計雙語卷答案計科081_第5頁](http://file4.renrendoc.com/view/3e92c94b0a2633f5f045b476af9363b9/3e92c94b0a2633f5f045b476af9363b95.gif)
下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、2008 年2009 年第二學(xué)期面象程序設(shè)計(雙語)期末試題C 卷計科 081-2 班一、Describe conceptions and give exles (每小題 10 分,共 20 分)1. Describe the definition of Friend function (友員函數(shù)). Please give an exle.Answer: Friend functions are not members of a class, b variables of the class(此處給出正確定義得 5 分)an acs private memberFor Exle:class
2、DayofYear public:friend bool equal(DayofYear date1, DayofYear date2); /友員函數(shù)DayofYear (); private:month; day;/友員函數(shù)的實現(xiàn)bool equal(DayofYear date1, DayofYear date2) return(date1.month= =date2.month&date1.day= =date2.day);(給出正確的實例得 5 分)2. Describe the definition of Dynamic Variables (動態(tài)變量). Please givean
3、exle to create a dynamic variable of typeAnswer: new operator can create variables.ve no identifiers to serve as theirnames; the variables are called dynamic variables. (此處給出正確定義得 5 分)For Exle:*p;p= new;(給出正確的實例得 5 分)二、Rerograms, and give the results (每小題 10 分,共 30 分)1. What is the output produced b
4、y the followinAnswer:oHow are you?o lines.2. What is the output produced by the following program.Answer:Try block entered. Exception thrown with wait_time equal to 46 After catch block.3. Consider the following code:Answer: ab三、Programming (每小題 10 分,共 50 分)1. Write a complete( 完整) C+ program messag
5、e on the screen.Answer:#include t output( 輸出)the followingusing namespamain( )td;double n1=1.0,n2=2.0;coute! endl;coutn1tn1endl; coutn2tn2n2)return n1; elsereturn n2;double max(double n1, double n2, double n3) double m;if(n1n2) m=n1;elsem=n2; if(n3m) m=n3; return m;3. Write a programt input some num
6、bers of typefrom keyboard(鍵盤)and output the numbers to a file “outfile.dat”.Answer: #include #include #include #includeusing namespa main() next;td;ofstream outfile; outfile.open(outfile.dat); if(outfile.fail()coutthe open file is failed!next) outfilenextendl;outfile.close(); return 0;4. According t
7、o the following test program, define and implement a class which can use the following program to test it.Answer:class Employee public:Employee ();Employee (string name, void show();private:string emp_name; data1;data2;string emp_depart;n1,n2, string depart);Employee: Employee():emp_name(“”),data1(0
8、),data2(0),emp_depart(“”) Employee: Employee(string name, emp_name=name;data1=n1; data2=n2; emp_depart=depart;void Employee:show()n1,n2, string depart)cout”the employees name is emp_nameendl”the employees data1 is data1endl”the employees data2 is data2endl”the employees department is departendl;5. T
9、here is a base class Student as follows:Answer:#include #includeusing namespatd;class Computer_stu:public Studentpublic:Computer_stu();Computer_stu(string no,string name,string depart1,double score1); void show_infor();private:string depart; double score;Computer_stu: Computer_stu():Student()depart=; score=0;puter_stu(string score1):Student(no,name)depart=depart1; score=score1;void Computer_stu:show_infor()no,stringname,stringdepart1,doublecoutthe students number is:stu_noendlthe students name is:stu_nameendlthe students depart is:departendlthe
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權(quán)】 ISO/TR 23975:2025 EN Traditional Chinese medicine - Priority list of single herbal medicines for developing standards
- 2025年度店鋪轉(zhuǎn)租雙方責(zé)任劃分合同
- 2025年度房地產(chǎn)項目風(fēng)險評估合同模板
- 2025年度財務(wù)合同簽訂與履行管理合同
- 2025年度鑄件研發(fā)與生產(chǎn)承包協(xié)議
- 2025年度員工敬業(yè)度提升與企業(yè)文化融合合同
- 藝術(shù)創(chuàng)作活動的組織與管理計劃
- 現(xiàn)代青年財務(wù)觀念調(diào)查計劃
- 財務(wù)內(nèi)控體系的構(gòu)建與完善計劃
- 小學(xué)美術(shù)教育工作規(guī)劃計劃
- 2025年度劇本殺劇本版權(quán)授權(quán)與收益分成合同
- 2025年春季學(xué)期學(xué)校工作計劃及安排表
- 2025年一種板式過濾膜裝置項目投資可行性研究分析報告
- BMS基礎(chǔ)知識培訓(xùn)
- 水刀除銹施工方案
- 質(zhì)保管理制度
- 2024年全國卷新課標(biāo)1高考英語試題及答案
- 2024-2025學(xué)年高二上學(xué)期期末復(fù)習(xí)解答題壓軸題十七大題型專練(范圍:第四、五章)(含答案)
- 2024年10月自考13003數(shù)據(jù)結(jié)構(gòu)與算法試題及答案
- 華為經(jīng)營管理-華為激勵機(jī)制(6版)
- 2024年標(biāo)準(zhǔn)化工地建設(shè)管理實施細(xì)則(3篇)
評論
0/150
提交評論