08092面向?qū)ο蟪绦蛟O(shè)計雙語卷計科081_第1頁
08092面向?qū)ο蟪绦蛟O(shè)計雙語卷計科081_第2頁
08092面向?qū)ο蟪绦蛟O(shè)計雙語卷計科081_第3頁
08092面向?qū)ο蟪绦蛟O(shè)計雙語卷計科081_第4頁
08092面向?qū)ο蟪绦蛟O(shè)計雙語卷計科081_第5頁
已閱讀5頁,還剩1頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論