歡迎來(lái)到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁(yè) 裝配圖網(wǎng) > 資源分類(lèi) > DOC文檔下載  

面向?qū)ο蟪绦蛟O(shè)計(jì)(C++)(雙語(yǔ))

  • 資源ID:31771728       資源大?。?span id="q20y8iq" class="font-tahoma">121.50KB        全文頁(yè)數(shù):20頁(yè)
  • 資源格式: DOC        下載積分:15積分
快捷下載 游客一鍵下載
會(huì)員登錄下載
微信登錄下載
三方登錄下載: 微信開(kāi)放平臺(tái)登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要15積分
郵箱/手機(jī):
溫馨提示:
用戶(hù)名和密碼都是您填寫(xiě)的郵箱或者手機(jī)號(hào),方便查詢(xún)和重復(fù)下載(系統(tǒng)自動(dòng)生成)
支付方式: 支付寶    微信支付   
驗(yàn)證碼:   換一換

 
賬號(hào):
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會(huì)被瀏覽器默認(rèn)打開(kāi),此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁(yè)到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請(qǐng)使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無(wú)水印,預(yù)覽文檔經(jīng)過(guò)壓縮,下載后原文更清晰。
5、試題試卷類(lèi)文檔,如果標(biāo)題沒(méi)有明確說(shuō)明有答案則都視為沒(méi)有答案,請(qǐng)知曉。

面向?qū)ο蟪绦蛟O(shè)計(jì)(C++)(雙語(yǔ))

江西財(cái)經(jīng)大學(xué)06-07學(xué)年第一學(xué)期期末考試試卷試卷代碼: 03874B 課時(shí): 64學(xué)時(shí)課程名稱(chēng):面向?qū)ο蟪绦蛟O(shè)計(jì)(C+)(雙語(yǔ)) 適用對(duì)象:05級(jí)信管、信計(jì)一、Single-Choice (Every question is 2 point, total is 32 point)1、( ) has the same function as the sentence: printf(“Hello worldn”) in C language.A. cout>>”Hello worldn” B. cin>>”Hello worldn”C. cout<<”Hello worldn” D. cin<<”Hello worldn”2、The result of the program is ( ).#include <iostream.h>double f(double x, int n) double val = 1.0; while (n-)val = val*x;return(val); void main(void) cout << f(5,2) << endl; A. 10 B. 7 C. 25 D. 33、For pointers, ( ) is not right.A. int i; int* ptr=&i B. int i; int *ptr; i=*ptrC. int *ptr; ptr=0 D. int i=5; int *ptr; *ptr=i4、In the following functions, ( ) can not be overloaded.A. Common member functions B. Common non-member functionsC. Destructor D. Constructor5、After executing the following program, ( ) is the result.#include<iostream.h>void Swap(int a, int b)int t;t=a;a=b;b=t;int main() int x=5, y=10; Swap(x,y); cout<<"x="<<x<<" y="<<y<<endl; return 0; A. x=5 y=10 B. x=10 y=5 C. x=5 y=5 D. x=10 y=106、If a derived class is gained from a base class by private inherit, the private and public members in the base class will become ( ) members for derived class. A. public B. private C. protectedD. friend7、For operator overloading, ( ) is correct.A. The number of operands can be changedB. The priority for operators can be changed C. The syntax for operators cant be changedD. The combination sequence can be changed8、( ) is not right for the description of class.A. Class is a user defined type B. The private members can be accessed by friend functions in classC. In class, without declaration the member data are private D. In class, without declaration the member functions are public9、Given a class MyClass, after executing the sentence: MyClass a, b, *p, the constructor will be called ( ) times.A. 1 B. 2 C. 3 D. 410、The default constructor can exist in the situation of ( ).A. All the timeB. No copy constructor is givenC. No constructor with arguments is givenD. No constructor is given 11、A friend function in a class or a friend class can access ( ) of the class. A. public members B. protected members C. private members D. all members12、For static member data, it is initialized at().A. Before the declaration of class and after the main functionB. Before the main function and after the declaration of classC. In the classD. In the main function13、( ) is equal to the sentence: while(!x).A. x=1 B. x!=1C. x!=0 D. x=014、For macros, ( ) is the result of the following program.#include <iostream.h>#define ONE 1#define TWO ONE+ONE#define THREE ONE+TWOvoid main() cout<<THREE<<endl; cout<<(TWO)*5<<endl;A. 2 10 B. 1 10 C. 3 10 D. 0 015、In the case of ( ), it can be used inline functions.A. There are cycle sentences in the function like for(int i)B. There are recursive sentences in the functionC. In order to speed the functionD. There are many codes in the function and they are not frequently used 16、For the descriptions of pure virtual functions and abstract class, () is wrong.A. Pure virtual function is a special function without given definitionsB. Abstract class is a class with pure virtual functionsC. If a base class has pure virtual functions, the derived class form it will never be abstract class D. Abstract class can be used as base class, the pure virtual functions in it will defined in the derived class二、Judgment, if it is right please otherwise . (Every question is 2 point, total is 18 point)1、C+ is a sub-set of C, it reserves almost all the characteristics of C.-2、Given int a; int b=a; a=10; b=20; if cout<<a<<,<<b; the result is: 20,20.-3、Given class AB, the copy constructor can be defined as: AB:AB(const AB &).-4、Both constructor and destructor can not be overloaded.-5、If class B is a friend of class A, then all member functions of class B can access the members in class A, vice versa.-6、For a non-member operator overloading function, a mode computation can de defined as: X operator%(X), where X is the name of a class.-7、No objects of an abstract base class can be instantiated.-8、Given class B int x; /*.*/; we can define class D: public Bint z; public: void SetXZ( int a, int c) x=a; z=c; int Sun() return x+z;-9、Object of a base class can be treated as an object of the derived class.- 三、Complete the program (3*5=15) (Every question is 5 point, total is 15 point) (attention: one line for just one sentence)1、After the main function, the result is: x=0;y=0x=3;y=5x=3;y=5Destructor is called.Destructor is called.Destructor is called.Please complete the program.#include <iostream.h>void main()demo d;d.show();demo d1(3,5); d1.show(); demo d2(d1); d2.show();class demoint x, y;public:-x=a; y=b;- x=d.x;y=d.y;- - void show()-;2、#include <iostream.h> #include <string.h>class personchar *Name;int Age;public:person(char * name, int age); person();char *GetName()return Name;int GetAge()return Age;void show(); ;person:person(char * name, int age) - Age=age;person:person()delete Name;void person:show() cout<<GetName()<<t<<GetAge()<<endl;class student :public personchar *Department; int Number;public:student(char *, int , char*, int);student() delete Department;void SetDep(char *) / the implementation is omittedvoid SetNum(int num) Number=num; char *GetDep() return Department;int GetNum() return Number;-Number=num;3、The following program is used to calculate the distance between two points, please complete the program.#include <iostream.h>#include <math.h>class Pointpublic: Point(double xx=0, double yy=0) X=xx;Y=yy; double GetX() return X; double GetY() return Y; -private:double X,Y;double Dist( Point& a, Point& b) - - return sqrt(dx*dx+dy*dy);int main() Point p1(3.0, 5.0), p2(4.0, 6.0); - cout<<"The distance is "<<d<<endl; return 0;The result is-四、Read the program and write out the result. (Every question is 5 point, total is 20 point)1、Please write the result of the following program:#include <iostream.h>int sub(int n)int a; if(n=1) return 1; a=n+sub(n-1); return(a); void main() int i=5; cout<<sub(i)<<endl; 2、Please write the result of the following program:#include <iostream.h>class testprivate:int num;float fl;public:test( );int getint( )return num;float getfloat( )return fl;test( );test:test( )cout<<"Initalizing default"<<endl;num=0;fl=0.0;test:test( )cout<<"Destructor is active"<<endl;void main( )test array2;cout<<array1.getint ( )<<","<<array1.getfloat()<<endl;3、Please write the result of the following program:#include<iostream.h>#include< string.h>class Student string name;public: static int num; Student (string& str) name = str; +num; ;int Student:num = 0; int main() Student s1("Smith"), s2(“John”); cout<<”Student:num=”<< Student:num <<“n”; Student s3("Marry"), s4(“Tom”); cout<<" s3.num="<< s3.num <<endl;cout<<" s4.num="<< s4.num <<endl;4、Please write the result of the following program:#include <iostream.h>class B1 public:B1(int i) cout<<"constructing B1 "<<i<<endl;B1() cout<<"destructing B1 "<<endl;class B2public:B2(int j) cout<<"constructing B2 "<<j<<endl;B2() cout<<"destructing B2 "<<endl;class B3public:B3() cout<<"constructing B3 *"<<endl;class C: public B2, public B3, public B1 public:C(int a, int b, int c, int d): B1(a),memberB2(d),memberB1(c),B2(b)cout<<"constructing C"<<endl;C() cout<<"destructing C "<<endl;private:B2 memberB2;B1 memberB1;B3 memberB3;void main()C obj(1,3,5,7);五、Programming (The question is 15 point)According to the description, design a program with main function. (Description: In the first step, please declare an abstract class Shape. Then, based on it two classes named Rectangle and Circle are derived. In both the two classes, the functions GetArea() calculating for the area and GetPeri() calculating for the perimeter must be involved.) 江西財(cái)經(jīng)大學(xué)06-07學(xué)年第二學(xué)期期末考試試卷試卷代碼: 03874A 課時(shí): 64學(xué)時(shí)課程名稱(chēng):面向?qū)ο蟪绦蛟O(shè)計(jì)(C+)(雙語(yǔ)) 適用對(duì)象:計(jì)算機(jī)及其相關(guān)專(zhuān)業(yè) 試卷命題人:楊勇 試卷審核人:舒蔚 I、Single-Choice (Every question takes 2 points, the total score is 32 points)1、When we input “ Tao Zou” , the output of the following program is ( ) consequently.#include<iostream>#include <string>using namespace std;int main( ) string str; cout<<"please enter your name"<<endl; cin>>str; cout<<"hello, "<<str<<"!n"A. hello, Zou! B. hello, Tao! C. hello, Tao Zou! D. hello,!2、The statement ( ) is not the characteristic of the standard library. A. It supports Strings and I/O streamsB. B. It supports the C standard library with very minor modifications C. It Supports for numerical computation D. It supports compiling checking errorsE.3、After executing the following program, ( ) is the running result.#include<iostream.h>long fac(int n) long f; if (n>1) f=n*fac(n-1); else f=1; return f;void main() cout<<fac(6)<<endl;A. 120 B. 720 C. 30. D . 14、Given a class MyClass, after executing the sentence: MyClass a2, b, *p, the destructor MyClass( ) will be called ( ) times.A. 1 B. 2 C. 3 D. 45、In order to improve the speed of the function, the function can be written as ( ). A. Inline function B. Function overloading C. Recursive function D. Friend function6、The running results of the program are ( ). #include <iostream.h> void func(int p, int &q) int t; t=p; p=q; q=t; void main() int x=1,y=2; func(x,y); cout<<x<<”,”<<y<<endl;A. 1, 2 B. 2, 1 C, 1, 1 D. 2, 27、For functions with default arguments, ( ) is not wrong.A. int add(int x,int y=5,int z=6)B. int add(int x=1,int y=5,int z)C. int add(int x=1,int y,int z=6)D. int add(int x,int y=5,int z)E.8、C+ has the following characteristics except ( ). A. Polymorphism B. Object C. Abstract D. Inheritance 9、One of the following description is right, it is ( ).A. C+ is a sub-set of C, it reserves almost all the characteristics of CB. Both constructor and destructor can not be overloadedC. If class B is a friend of class A, then class A is also the friend of class BD. No objects of an abstract base class can be instantiated10、For a non-member operator overloaded function, a mode computation can de defined as( ).A. X operator%(const X)B. X operator%( const X, const X)C. X operator%( )D. void operator%( const X, const X)11、( ) is not true for the description of constructor.A. The constructor should have the same name as the class nameB. The system will automatically call the constructor during defining objectC. No returning type for the constructorD. The constructor can have just only one12、Among the following descriptions, ( ) is not correct.A. Inside inline function, there is no cycle and switch sentences.B. Using the same name for operations on different types is called overloadingC. Given the function prototype: double sqrt(double), we can write cout<< sqrt("three")D. The form of operator overloading for prefix increment is like: type operator +()13、For virtual functions, among the following declarations ( )is right.A. Virtual functions can be defined as friend functionsB. Virtual functions can be overloadedC. Constructors can be virtual functions, while destructors cannotD. Virtual functions cannot be defined as static functions14、If we want to define a friend function of class AB, we can define it as:A. void friend func(AB&)B. friend func(AB&)C. friend int func(AB&)D. friend void func()15、About class and object, ( ) is wrong.A. A class can just have one object B. Class is an abstract of one type of objectsC. Object is an instance of a class D. The relation like the variables and their type 16、For static member data, it is initialized at().E. Before the declaration of class and after the main functionF. Before the main function and after the declaration of classG. In the class declarationD. In the main functionII、True or False (Six programs are given in the following, for each of them, if it is defined correctly, please mark “” for it, else please mark “” and point out the wrong sentences or sentence. Each question takes 3 points, the total score is 18 points)1、void main() int *p= new int(3); int *q; q=p; cout<<*p<<endl; p+=3;/ other operations delete p; 2、class rectangle public:Rectangle( ); Rectangle(int width=4, int length=6); Rectangle() private: int width; int length; ;int main() Rectangle rect1; Rectangle rect2(4,5); 3、class StudentID public: StudentID(int id) value=id; cout<<"Assigning student id"<<value<<endl; protected: int value;class student public: student(char * pName="no name", int ssID=0) cout<<"Constructing student,"<<pName<<endl; protected: StudentID id;void main() Student s(“Randy”,9818);student t(“Jenny”);4、class Pointpublic:Point(double xx=0, double yy=0) X=xx;Y=yy;double GetX() return X;double GetY() return Y;friend double Dist(Point &a, Point &b); private:double X,Y;double Point :Dist( Point& a, Point& b) double dx=a.X-b.X; double dy=a.Y-b.Y; return sqrt(dx*dx+dy*dy);5、class A public: void setA(int); void showA(); private: int a;class B public: void setB(int); void showB();private: int b;class C : public B, A public: void setC(int, int, int); void showC();private: int c;int main() C obj; obj.setA(5); obj.showA(); obj.setC(6,7,9); obj.showC();obj.setB(6); obj.showB(); 6、class A public: void f();void g();class B public: void f(); void g();class C: public A, public B public: void g(); void h();void main() C c;c. g();c. f(); III、Complete the program (Every question takes 5 points, the total score is 15 points) (Note: one line for only one C+ sentence)1、 According to the running results of the following program, please complete the program.Results: 9 18 27 3210#include <iostream>using namespace std;class myclass int num; -public:myclass(int x)num=x;- myclass() sum=sum-1; - - void display() cout<<num<<t<<sum<<endl; ; - void main() myclass a(9); a.display(); myclass b(8); b.display();- c.display(); 2、#include <iostream.h> #include <string.h>class personchar *Name;int Age;public:person(char * name, int age); person();char *GetName()return Name;int GetAge()return Age;void show(); ;person:person(char * name, int age) - Age=age;person:person()delete Name;void person:show() cout<<GetName()<<t<<GetAge()<<endl;class student :public personchar *Department; int Number;public:student(char *, int , char*, int);student() delete Department;void SetDep(char *) / the implementation is omittedvoid SetNum(int num) Number=num; char *GetDep() return Department;int GetNum() return Number;-Number=num;3、After the main function, the running results are: constructer be called.birthday:1988-10-25number:12345 sex:f id:9destructor be called.Please complete the program.#include <iostream>using namespace std;class birthdayprivate: int year, month, day; public: birthday(int Year,int Month,int Day)year=Year; month=Month; day=Day; - void show() cout<<" birthday: "<<year<<"-"<<month<<"-"<<day<<endl; ;class people private: - int number; char sex; int id;public: people(int n,char m,int s,birthday d) number=n ;sex=m;id=s; b=d; cout<<"constructer be called."<<endl; people()- void display(); ; void people:display() - cout<<"number:"<<number<<"t sex:"<<sex<<"t"<<"id:"<<id<<endl;void main() birthday d(1988,10,25); people c(12345,f,9,d);-IV、Read the following programs and write down the running results (Every question takes 5 points, the total score is 20 points)1、Please write down the running results of the following program:#include<iostream.h>class simplecat public: simplecat(int age=1, int weight=2); int GetAge() return itsage; int GetWeight() return itsweight; private: int itsage; int itsweight; ; simplecat:simplecat(int age, int weight) itsage=age; itsweight=weight;void main()simplecat F1; cout<<F1.GetAge()<<t<<F1.GetWeight()<<endl;simplecat F2(5); cout<<F2.GetAge()<<t<<F2.GetWeight()<<endl; simplecat F3(5,8); cout<<F3.GetAge()<<t<<F3.GetWeight()<<endl; 2、Please write down the running results of the following program:#include <iostream.h>class Cint d;static int s;public:C(int a=0) d=a; s+; int GetD() return d;int GetS() return s;void SetD(int a) d=a;int C:s=0;void main()C c5;for (int i=0; i<5; i+)ci.SetD(i+1);for (i=0; i<5; i+)cout<<"c"<<i<<".d="<<ci.GetD()<<t<<"c"<<i<<".s="<<ci.GetS()<<endl; 3、Please write down the running results of the followin

注意事項(xiàng)

本文(面向?qū)ο蟪绦蛟O(shè)計(jì)(C++)(雙語(yǔ)))為本站會(huì)員(仙***)主動(dòng)上傳,裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請(qǐng)重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話(huà):18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶(hù)上傳的文檔直接被用戶(hù)下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!