freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

面向?qū)ο蟪绦蛟O(shè)計(jì)c復(fù)習(xí)題-wenkub.com

2025-04-14 12:24 本頁面
   

【正文】 } ( ) 。 k=10 。 } int n,k。 // 定義輸出文件流file1。e1。 p=amp。void fun(base *ptr) //普通函數(shù){ ptr display( )。 //虛成員函數(shù)}}。class circle:public base //公有派生{ protected: double r,s,p。 coutsubarea(obj1,obj2)endl。s2) {return ()()。} float area() { s=3r*r。}16. 有一正方體形環(huán),其中小正方形連長為5,大正方形連長為10。void main(){ Housing hob(5,7,140,2,2)。 cout extinguishers: extinguishersendl。 extinguishers=ex。 }private: int bedrooms。 } void show() {cout\n HOUSING:\n。 double footage。 cout rooms: roomsendl。程序代碼:include class Building{public: Building(int f,int r,double ft) {floors=f。 ()。} void display() { strcat(str2,str1)。public: onestr(char *p) {strcpy(str1,p)。}14. 定義一個字符串onestr,包含一個存放字符串的成員變量,能夠通過構(gòu)造函數(shù)初始化字符串,通過成員函數(shù)顯示字符串的內(nèi)容。 obj。 obj++。 *this。 Point::operator (){ X。}Point Point::operator ++(int){ Point temp=*this。Pointamp。Point operator (int)。 operator ++()。答案:include class Point{public:Point() { X=Y=0。 ()。void main(){ Tdate obj1,obj2(2008,1,30)。month=m。public: Tdate(int y=2008,int m=1,int d=1) {year=y。}12. 定義一個日期類date,它有三個私有數(shù)據(jù)成員:年、月、日和若干個成員函數(shù),并實(shí)現(xiàn)如下要求:(1)用構(gòu)造函數(shù)對數(shù)據(jù)成員賦值;(2)定義一個函數(shù)打印日期。 cinn。 } void show() { cout 階乘為:pendl。 if(j=0) for(int i=1 。}11. 編寫一個程序,采用一個類求n!,并輸出10!的值。void main(){ rectangle a(10,20)。 return s。includeclass rectangle{ int len,wid。 ()。void main(){ Counter a。} void de_Counter() {n。includeclass Counter{ int n。 rectangle b(100,200)。 return p。wid=j。cout”The distance is: ”Distance(q1,q2)endl。double Distance(Point p1,Point p2){ double dx=double()。} int ycord (){ return y。}方法2:將兩點(diǎn)之間距離函數(shù)聲明為Point類的友元函數(shù)。 dist=sqrt(x*x+y*y)。 double dist。}。 y=b。 ( )。 //使用重載運(yùn)算符 coutc3=c1c2=。( )。 }plex operator+(plex c1,plex c2) //運(yùn)算符重載友元函數(shù)實(shí)現(xiàn) { return plex(+,+)。 //顯示復(fù)數(shù)的值 private: //私有數(shù)據(jù)成員 double real。imag=i。 fun(p)。d1。 p=amp。 }void main( ) //主函數(shù){ base *p。class outcircle:public circle //公有派生{ public: outcircle(double x=0): circle(x) {} void display( ) { cout外切正方形面積4*r*rendl。public: incircle(double x=0): circle(x) {} void display( ) { a=sqrt(r)。} void display( ) { cout圓的面積 r*r*PIendl。)include define PI includeclass base //抽象基類B0聲明{ public: //外部接口 virtual void display( )= 0。 ()。}。 cout phones: phonesendl。class Office:public Building{public: Office(int f,int r,double ft,int ph,int ex):Building(f,r,ft) { phones=ph。 cout bathrooms: bathroomsendl。bathrooms=bth。 int rooms。 } void show() { cout floors: floorsendl。然后,編制應(yīng)用程序,建立住宅樓對象和辦公樓對象,并輸出它們的有關(guān)數(shù)據(jù)。 //專業(yè) double score。 //工資 …… ……}。 //年齡 …… ……}。 }3. 定義一個基類有姓名、性別、年齡,再由基類派生出教師類和學(xué)生類,教師類增加工號、職稱和工資,學(xué)生類增加學(xué)號、班級、專業(yè)和入學(xué)成績。class Dog :public Mammal{ public: Dog() {coutcall Dog\n。}2. 聲明一個哺乳動物Mammal類,再由此派生出狗Dog類,聲明一個Dog類的對象,觀察基類與派生類的構(gòu)造函數(shù)與析構(gòu)函數(shù)的調(diào)用順序。st[j+1]=t。i++)          // 采用冒泡排序法對總分排序 for(j=0。 //讀入三門課成績 st[n].sum=st[n].math+st[n].eng+st[n].c。 while(x)      { cinx。int n=1。 int eng。}四 程序1. 定義一個第3題的結(jié)構(gòu)體類型的結(jié)構(gòu)體數(shù)組stud,輸入學(xué)生三門課成績,然后按總分成績排序后輸出學(xué)生成績。 Cder2 cc。 Cder2(int n=0) { small=n。} void showsmall() { coutsmall=smallendl。 Croot( ) { small=2。 ()。 }}。 }}。coutConstructor1.\n。}}。 } ~Text() {coutText des!\n。}}。 39。 z=xy。}}。,39。 return d。 return d。 b=j。 coutd=dendl。 for(int i=0。 }}。 for(int j=0。 in。 coutendl。 coutendl。} ~A() {cout對象被刪除\n。 ()。} } 。strcpy(b,bb)。 strcpy(a, 喂,)。 ()。 Cder1 bb(3)。class Cder2: public ROOT{ public: int small。 ROOT(int n=2) { small=n。 ()。 }}。} Csample::~Csample( ) { coutDestructorendl。}。}14. (14)include class Csample { int i。 f(z)。void f(A amp。 ( )。 k++。 void Display( )。 ()。} ~Csample() {coutDestructorendl。 i=0。void main() { EX1 x,y(10,2)。 couta39。 39。} display()。}void main(){ Point a。 y=1。void main() {Point a。} ~Point(){coutPoint x39。 ()。void main(){ EX a(30,10) , b(2,5),c。b39。} void show() {cout39。} EX operator /(EX c) { EX d。} EX operator * (EX z) { EX d。 ()。void main(){ BB x(2,6) , y(5, 5),z。b39。} void show() {cout39。} BB operator (BB c) { BB d。} BB operator +(BB c) { BB d。void main() { A x,y(10,5)。 couta39。 39。 } ()。void main() { A a。} ~A() {n?!4. (4) includeint n=0。 coutDestructor!endl。public: A(char *s) { a=new char[strlen(s)+1]。 cout39。}void main(){ ab x={39。void f(ab amp。endl。}。32. 引進(jìn)虛基類的根本目的是為了消除二義性。 28. 一個類的成員函數(shù)也可以成為另一個類的友元函數(shù),這時(shí)的友元說明必須在函數(shù)名前加上 friend 的限定。25.假定AB為一個類,則該類的復(fù)制構(gòu)造函數(shù)的函數(shù)頭為AB(AB amp。22.在一個類中定義復(fù)制構(gòu)造函數(shù)的目的,是為了當(dāng)利用該類的一個對象初始化另一個對象時(shí),能夠避免這兩個對象的同一指針同時(shí)指向同一塊 地址 。,則在類外給出完整定義
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)教案相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1