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

正文內(nèi)容

c面向?qū)ο蟪绦蛟O計上機考試題庫-全文預覽

2025-04-17 23:34 上一頁面

下一頁面
  

【正文】 mp。 Y = yi 。return 0。 dist=sqrt(dx*dx+dy*dy)。 double dist。} 。 Y = yi 。 return 0。 cout::endl。 year=y。 int year。,const Time amp。 minute=m。 int minute。 friend void display(const Date amp。ime類和Date類的友元函數(shù),在主函數(shù)中分別定義兩個帶參數(shù)的對象t1(12,30,55),d1(3,25,2010), 調(diào)用desplay,輸出年、月、日和時、分、秒。 Date d1(3,25,2010)。 } void Time::display(const Date amp。 }。)。 minute=m。 int minute。class Time {public: Time(int,int,int)。}2.設計一個Time類,包括三個私有數(shù)據(jù)成員:hour,minute,sec,用構(gòu)造函數(shù)初始化,內(nèi)設公用函數(shù)display(Date amp。 Goods *g2 = new Goods( w ) 。 main ( ){ int w 。 private : int weight 。 int Weight ( ) { return weight 。 totalWeight += w 。 ()。 ( 80, 76, 91 )。 }。class Cteacher: public CPerson {public: void Inputage(double age) { tage = age。 i3。 dbScore[1] = score2。 char pID[20]。 cout編號:pIDendl。 pID[n] = 39。 pName[n] = 39。}20. 定義一個人員類Cperson,包括數(shù)據(jù)成員:姓名、編號、性別和用于輸入輸出的成員函數(shù)。 Trapezoid trapezoid(,)。 printArea(circle)。void printArea(const Shape amp。 }。 protected: double radius。class Shape{public: virtual double area() const =0。 cout\ncRef as a Circle:cRef。pRef=cy1。 ()。 return output。}ostream amp。Cylinder::Cylinder(float a,float b,float r,float h) :Circle(a,b,r),height(h){}void Cylinder::setHeight(float h){height=h。,const Cylinderamp。 float area() const。 return output。}ostream amp。}。operator(ostream amp。 void setRadius(float)。output,const Point amp。}void Point::setPoint(float a,float b){x=a。protected: float x,y。} friend ostream amp。include class Point{public: Point(float=0,float=0)。cout總成績()\n。cinabc。cinName。 float a,b,c。 private: float fScore[3]。cout學號:strStuNO。 fScore[0] = s0。includeinclude class CStuScore { public: char strName[12]。 pare(string1,string2)。cout。 else return false。}void String::display() {coutp。 void display()。} String(char *str)。 return 0。()。}void pare(String amp。} bool operator(String amp。 private: char *p。 friend bool operator(String amp。}15. 定義一個字符串類String,用來存放不定長的字符串,重載運算符,用于兩個字符串的小于的比較運算。} coutendl。string1,String amp。string1,String amp。 }。string1,String amp。初值自擬。 coutc1+c2=。 coutc1=。c2) {return Complex(+, +)。 double imag。c1,Complex amp。imag=0。初值自擬。 coutendlMatrix c = Matrix a + Matrix b :endl。 ()。}}int main(){Matrix a,b,c。i++) {for(int j=0。j3。} void Matrix::input() {coutinput value of matrix:endl。i++) for(int j=0。a,Matrix amp。i++) for(int j=0。 private: int mat[2][3]。,Matrix amp。如c=a+b。 return 0。 ()。 coutc1+c2=。c){return Complex(i+,)。i){return Complex(real+i,imag)。 }。)。 Complex operator+(int amp。} Complex(double r,double i){real=r。編程序,分別求兩個復數(shù)之和、整數(shù)和復數(shù)之和。 return 0。 ()。}void Complex::display(){cout(real,imagi)endl。c2){Complex c。 =real**。 double imag。 Complex operator/(Complex amp。} Complex(double r,double i){real=r。兩復數(shù)相除的計算公式為:(a+bi)/(c+di)=(ac+bd)/(c*c+d*d)+(bcad) /(c*c+d*d)i。運算符重載函數(shù)作為Complex類的成員函數(shù)。 coutc1c2=。 c3=c1+c2。 =。 return c。 Complex Complex::operator+(Complex amp。 void display()。} Complex operator+(Complex amp。class Complex {public: Complex(){real=0。}9. 定義一個復數(shù)類Complex,重載運算符“+”,“—”,使之能用于復數(shù)的加,減運算,運算符重載函數(shù)作為Complex類的成員函數(shù)。 c3=c1+c2。}Complex operator + (Complex amp。 }。 double get_imag()。imag=0。編寫程序,求兩個復數(shù)之和。 delete []p。i=10。includeiostreamincludestringusing namespace std。i++) if(arr[i].scoremax_score) {max_score=arr[i].score。 } void max(Student *arr){float max_score=arr[0].score。 void max(Student* )。class Student {public: Student(int n,float s):num(n),score(s){} int num。 return 0。 Student *p=stud。 double score。初值自擬。 cout() is the Maximum of two characters.endl。a39。 Comparefloat cmp2(,)。 }。y=b。 return 0。 } int main() { Box box1(10,20,25)。 int width。 include iostreamusing namespace std。 return 0。 } int main() { Box box1(30,20,10)。Box::Box(int len,int h,int w) {length=len。 private: int length。編一個基于對象的程序,在類中用帶參數(shù)的構(gòu)造函數(shù)。()。 }}。} void volue() {v=x*y*z。 int v,s。includeiostreamclass Box { private: int x,y,z。z=z1。 couts= s v= vendl。()。分別求他們的體積。//帶參數(shù)的構(gòu)造函數(shù) int volume()。 }。 }//Box::Box(int len,int w,int,h):length(len),height(h),width(w){}int Box::volume() {return(length*width*height)。 coutThe volume of box2 is ()endl。編一個基于對象的程序,且定義兩個構(gòu)造函數(shù),其中一個有參數(shù),一個無參數(shù)。 private: int length。int Box::volume() {return(length*width*height)。 coutThe volume of box2 is ()endl。templateclass numtype//聲明一個類模板class Compare {public: Compare(numtype a,numtype b) {x=a。} private: numtype x,y。 cout() is the Minimum of two inteder numbers.endlendl。 Comparechar cmp3(39。)。} 5. 建立一個對象數(shù)組,內(nèi)放5個學生的數(shù)據(jù)(學號、成績),用指針指向數(shù)組首元素,輸出第1,3,5個學生的數(shù)據(jù)。 private: int num。} int main(){Student stud[5]={ Student(101,),Student(102,),Student(103,), Student(104,),Student(105,)}。p=p+2,i++) pdisplay()。include iostreamusing namespace std。void main(){Student stud[5]={ Student(101,),Student(102,),Student(103,), Student(104,),Student(105,)}。 max(p)。i5。} 7. 用new建立一個動態(tài)一維數(shù)組,并初始化int[10]={1,2,3,4,5,6,7,8,9,10},用指針輸出,最后銷毀數(shù)組所占空間。 for(int i=1。 } coutendl。將運算符函數(shù)重載為非成員、非友元的普通函數(shù)。class Complex {publ
點擊復制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1