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

正文內(nèi)容

c面向?qū)ο蟪绦蛟O(shè)計上機考試題庫-wenkub

2023-04-11 23:34:44 本頁面
 

【正文】 eal,imagi)endl。 Complex Complex::operator+(Complex amp。 void display()。i)。imag=i。初值自擬。}11. 定義一個復(fù)數(shù)類Complex,重載運算符“+”,使之能用于復(fù)數(shù)的加法運算。 c3=c1/c2。}int main(){Complex c1(3,4),c2(5,10),c3。 =(real*+imag*)/(*+*)。 =imag*+real*。 }。c2)。imag=i。include iostreamusing namespace std。編程序,分別求出兩個復(fù)數(shù)之積和商。 ()。 coutc1+c2=。 return c。} Complex Complex::operator(Complex amp。c2){Complex c。 private: double real。c2)。imag=0。編程序,分別求出兩個復(fù)數(shù)之和,差。 coutc3=。c1,Complex amp。 double Complex::get_real(){return real。 void display()。} Complex(double r,double i){real=r。初值自擬。 return。i++){ *(p+i1)=i。void main(){ int *p。k=i。 int k=0。 Student *p=amp。 float score。 }6. 建立一個對象數(shù)組,內(nèi)放5個學(xué)生的數(shù)據(jù)(學(xué)號、成績),設(shè)立一個函數(shù)max,用指向?qū)ο蟮闹羔樧骱瘮?shù)參數(shù),在max函數(shù)中找出5個學(xué)生中成績最高者,并輸出其學(xué)號。 for(int i=0。 }。include iostreamusing namespace std。 cout() is the Minimum of two characters.endl。,39。 cout() is the Maximum of two float numbers.endl。int main(){Compareint cmp1(3,7)。} numtype max() {return (xy)?x:y。 } 4. 聲明一個類模板,利用它分別實現(xiàn)兩個整數(shù)、浮點數(shù)和字符的比較,求出大數(shù)和小數(shù)。 coutThe volume of box1 is ()endl。 int height。class Box {public: Box()。 }3. 有兩個長方柱,其長、寬、高分別為:(1)12,20,25;(2)10,30,20。 coutThe volume of box1 is ()endl。 height=h。 int width。 include iostream using namespace std。()。void main(){ Box a。} void area() {s=2*(x*y+x*z+y*z)。 public: void int(int x1=0,int y1=0,int z1=0) {x=x1。C++面向?qū)ο蟪绦蛟O(shè)計上機考試題庫一、第一類題目(20道,每題7分,在word中保留代碼并將輸出結(jié)果窗口保留)1.定義盒子Box類,要求具有以下成員:長、寬、高分別為x,y,z,可設(shè)置盒子形狀;可計算盒子體積;可計算盒子的表面積。y=y1。} void show() {coutx= x y= y z=zendl。(2,3,4)。}2. 有兩個長方柱,其長、寬、高分別為:(1)30,20,10;(2)12,10,20。 class Box {public: Box(int,int,int)。 int height。 width=w。 Box box2(12,10,20)。分別求他們的體積。 Box(int len,int w ,int h):length(len),width(w),height(h){} int volume()。 }。 Box box2(10,30,20)。include iostreamusing namespace std。} numtype min() {return (xy)?x:y。 cout() is the Maximum of two inteder numbers.endl。 cout() is the Minimum of two float numbers.endlendl。A39。 return 0。class Student {public: Student(int n,double s):num(n),score(s){} void display()。void Student::display() {coutnum scoreendl。i=2。初值自擬。 }。stud[0]。 for(int i=1。} coutarr[k].num max_scoreendl。 p=new int[10]。 cout*(p+i1) 。}8. 定義一個復(fù)數(shù)類Complex,重載運算符“+”,使之能用于復(fù)數(shù)的加法運算。include iostreamusing namespace std。imag=i。 private: double real。}double Complex::get_imag(){return imag。c2){ return Complex(()+(),()+())。 ()。初值自擬。} Complex(double r,double i){real=r。 Complex operator(Complex amp。 double imag。 =real+。c2){Complex c。}void Complex::display(){cout(real,imagi)endl。 ()。 return 0。初值自擬。class Complex {public: Complex(){real=0。} Complex operator*(Complex amp。 void display()。Complex Complex::operator*(Complex amp。 return c。 =(imag**)/(*+*)。 c3=c1*c2。 coutc1/c2=。參加運算的兩個運算量可以都是類對象,也可以其中有一個是整數(shù),順序任意。include class Complex {public: Complex(){real=0。} Complex operator+(Complex amp。 friend Complex operator+(intamp。 private: double real。c){return Complex(real+,imag+)。}Complex operator+(int amp。 int i=5。 c3=i+c1。 coutc1+i=。求兩個矩陣之和。include class Matrix {public: Matrix()。 void input()。Matrix::Matrix() {for(int i=0。j++) mat[i][j]=0。 for(int i=0。j++) {[i][j]=[i][j]+[i][j]。i2。}void Matrix::display() {for (int i=0。j++) {coutmat[i][j] 。 ()。 ()。 return 0。imag=0。imag=i。 void display()。Complex operator+ (Complex amp。}int main(){Complex c1(3,4),c2(5,10),c3。 coutc2=。 return 0。} String(char *str)。 void display()。}void String::display() {coutp。 else return false。cout=。 pare(string1,string2)。include include class String {public: String(){p=NULL。string2)。 String::String(char *str){p=str。string2){if(strcmp(,)0) return true。string2){if(operator(string1,string2)==1) {()。}int main(){String string1(Book),string2(Computer)。初值自擬。string1,String amp。 }。string1,String amp。string1,String amp。} coutendl。}17. 定義一個描述學(xué)生基本情況的類,數(shù)據(jù)成員包括姓名、學(xué)號、C++成績、英語和數(shù)學(xué)成績,成員函數(shù)包括輸出數(shù)據(jù),求出總成績和平均成績。 void SetScore( char sname[12], char NO[9],float s0, float s1, float s2) { strcpy(strName, sname)。 fScore[2] = s2。 } float GetSUM() { return (float)((fScore[0] + fScore[1] + fScore[2]))。 float CStuScore::GetAverage() { return (float)((fScore[0] + fScore[1] + fScore[2])/)。 char StuNO[9]。cinStuNO。()。以它為基類,派生出一個Circle(圓)類,增加數(shù)據(jù)成員r(半徑),再以Circle類為直接基類,派生出一個Cylinder(圓柱體)類,在增加數(shù)據(jù)成員h(高)。 float getX() const {return x。,const Point amp。Point::Point(float a,float b){x=a。}ostream amp。 return output。 float area () const。)。}float Circle::getRadius() const {return radius。output,const Circle amp。 void setHeight(float)。 friend ostreamamp。 protected: float height。}float Cylinder::area() const{ return 2*Circle::area()+2**radius*height。output,const Cylinderamp。 cout\noriginal cylinder:\nx=(), y=(), r= (), h=()\narea=() , volume=()endl。 cout\nnew cylinder:\ncy1。 Circle amp。}19. 寫一個程序,定義抽象類型Shape,由他派生三個類:Circle(圓形),Rectangle(矩形),Trapezoid(梯形),用一個函數(shù)printArea分別輸出三者的面積,3個圖形的數(shù)據(jù)在定義對象是給定。class Circle:public Shape{public:Circle(double r):radius(r){} virtual double area() const {return *radius*radius。class Rectangle:public Shape{p
點擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1