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

正文內(nèi)容

c面向?qū)ο蟪绦蛟O(shè)計(jì)上機(jī)考試題庫-文庫吧資料

2025-04-02 23:34本頁面
  

【正文】 sing namespace std。 ()。 (zhangli,001)。 ( 80, 76, 91 )。 Cteacher tea。 }。 cout教齡:tageendl。class Cteacher: public CPerson {public: void Inputage(double age) { tage = age。 }private: double dbScore[3]。 i3。 } void Print() { Output()。 dbScore[1] = score2。 }。 char pID[20]。 cout性別:strendl。 cout編號:pIDendl。 bMan = isman。 pID[n] = 39。 n = strlen(id)。 pName[n] = 39。 include include class CPerson {public: void SetData(char *name, char *id, bool isman = 1) { int n = strlen(name)。}20. 定義一個(gè)人員類Cperson,包括數(shù)據(jù)成員:姓名、編號、性別和用于輸入輸出的成員函數(shù)。 printArea(trapezoid)。 Trapezoid trapezoid(,)。 coutarea of rectangle =。 printArea(circle)。} int main(){ Circle circle()。void printArea(const Shape amp。} protected: double width,height,length。 }。class Rectangle:public Shape{public: Rectangle(double w,double h):width(w),height(h){} virtual double area() const {return width*height。 protected: double radius。class Circle:public Shape{public:Circle(double r):radius(r){} virtual double area() const {return *radius*radius。class Shape{public: virtual double area() const =0。}19. 寫一個(gè)程序,定義抽象類型Shape,由他派生三個(gè)類:Circle(圓形),Rectangle(矩形),Trapezoid(梯形),用一個(gè)函數(shù)printArea分別輸出三者的面積,3個(gè)圖形的數(shù)據(jù)在定義對象是給定。 cout\ncRef as a Circle:cRef。 Circle amp。pRef=cy1。 cout\nnew cylinder:\ncy1。 ()。 cout\noriginal cylinder:\nx=(), y=(), r= (), h=()\narea=() , volume=()endl。 return output。output,const Cylinderamp。}ostream amp。}float Cylinder::area() const{ return 2*Circle::area()+2**radius*height。Cylinder::Cylinder(float a,float b,float r,float h) :Circle(a,b,r),height(h){}void Cylinder::setHeight(float h){height=h。 protected: float height。,const Cylinderamp。 friend ostreamamp。 float area() const。 void setHeight(float)。 return output。output,const Circle amp。}ostream amp。}float Circle::getRadius() const {return radius。}。)。operator(ostream amp。 float area () const。 void setRadius(float)。 return output。output,const Point amp。}ostream amp。}void Point::setPoint(float a,float b){x=a。Point::Point(float a,float b){x=a。protected: float x,y。,const Point amp。} friend ostream amp。 float getX() const {return x。include class Point{public: Point(float=0,float=0)。以它為基類,派生出一個(gè)Circle(圓)類,增加數(shù)據(jù)成員r(半徑),再以Circle類為直接基類,派生出一個(gè)Cylinder(圓柱體)類,在增加數(shù)據(jù)成員h(高)。cout總成績()\n。()。cinabc。cinStuNO。cinName。 char StuNO[9]。 float a,b,c。 float CStuScore::GetAverage() { return (float)((fScore[0] + fScore[1] + fScore[2])/)。 private: float fScore[3]。 } float GetSUM() { return (float)((fScore[0] + fScore[1] + fScore[2]))。cout學(xué)號:strStuNO。 fScore[2] = s2。 fScore[0] = s0。 void SetScore( char sname[12], char NO[9],float s0, float s1, float s2) { strcpy(strName, sname)。includeinclude class CStuScore { public: char strName[12]。}17. 定義一個(gè)描述學(xué)生基本情況的類,數(shù)據(jù)成員包括姓名、學(xué)號、C++成績、英語和數(shù)學(xué)成績,成員函數(shù)包括輸出數(shù)據(jù),求出總成績和平均成績。 pare(string1,string2)。} coutendl。cout。string1,String amp。 else return false。string1,String amp。}void String::display() {coutp。 }。 void display()。string1,String amp。} String(char *str)。初值自擬。 return 0。}int main(){String string1(Book),string2(Computer)。()。string2){if(operator(string1,string2)==1) {()。}void pare(String amp。string2){if(strcmp(,)0) return true。} bool operator(String amp。 String::String(char *str){p=str。 private: char *p。string2)。 friend bool operator(String amp。include include class String {public: String(){p=NULL。}15. 定義一個(gè)字符串類String,用來存放不定長的字符串,重載運(yùn)算符,用于兩個(gè)字符串的小于的比較運(yùn)算。 pare(string1,string2)。} coutendl。cout=。string1,String amp。 else return false。string1,String amp。}void String::display() {coutp。 }。 void display()。string1,String amp。} String(char *str)。初值自擬。 return 0。 coutc1+c2=。 coutc2=。 coutc1=。}int main(){Complex c1(3,4),c2(5,10),c3。c2) {return Complex(+, +)。Complex operator+ (Complex amp。 double imag。 void display()。c1,Complex amp。imag=i。imag=0。imag=0。初值自擬。 return 0。 coutendlMatrix c = Matrix a + Matrix b :endl。 ()。 ()。 ()。}}int main(){Matrix a,b,c。j++) {coutmat[i][j] 。i++) {for(int j=0。}void Matrix::display() {for (int i=0。j3。i2。} void Matrix::input() {coutinput value of matrix:endl。j++) {[i][j]=[i][j]+[i][j]。i++) for(int j=0。 for(int i=0。a,Matrix amp。j++) mat[i][j]=0。i++) for(int j=0。Matrix::Matrix() {for(int i=0。 private: int mat[2][3]。 void input()。,Matrix amp。include class Matrix {public: Matrix()。如c=a+b。求兩個(gè)矩陣之和。 return 0。 coutc1+i=。 ()。 c3=i+c1。 coutc1+c2=。 int i=5。c){return Complex(i+,)。}Complex operator+(int amp。i){return Complex(real+i,imag)。c){return Complex(real+,imag+)。 }。 private: double real。)。 friend Complex operator+(intamp。 Complex operator+(int amp。} Complex operator+(Complex amp。} Complex(double r,double i){real=r。include class Complex {public: Complex(){real=0。編程序,分別求兩個(gè)復(fù)數(shù)之和、整數(shù)和復(fù)數(shù)之和。參加運(yùn)算的兩個(gè)運(yùn)算量可以都是類對象,也可以其中有一個(gè)是
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1