悬赏100分关于C++的编程,高手指教!在线急等!

2025-04-23 21:36:08
推荐回答(2个)
回答1:

1答:
#include
class C_Sophomore
{public:
C_Sophomore();
C_Sophomore(int);
C_Sophomore(int,int);
int put_X(){return x;}
int put_Y(){return y;}
protected:
int x,y;
};
C_Sophomore::C_Sophomore()
{cout<<"the function with none of the parameter"<C_Sophomore::C_Sophomore(int i)
{cout<<"the function with a parameter"<x=i;
}
C_Sophomore::C_Sophomore(int i,int j)
{cout<<"the function with two parameters : "<
void main()
{C_Sophomore m1;
C_Sophomore m2(3);
C_Sophomore m3(4,5);
}

3.答:
#include
class point
{public:
point(double=0,double=0);
void put_point();
protected:
double x,y;
};
point::point(double i,double j)
{x=i;
y=j;
}
void point::put_point()
{cout<<"the point of the center is:"<<'('<class circle:public point
{public:
circle(double=0,double=0,double=0);
void put_radius();
void put_area();
protected:
double radius;
};
circle::circle(double r,double i,double j):point(i,j)
{radius=r;}
void circle::put_radius()
{cout<<"the radius of the circle is :"<void circle::put_area()
{cout<<"the area of the circle is :"<<3.14*radius*radius<class column:public circle
{public:
column(double=0,double=0,double=0,double=0);
void put_area();
void put_volumn();
protected:
double height;
};
column::column(double h,double r,double i,double j):circle(r,i,j)
{height=h;
}
void column::put_area()
{cout<<"the area of the column is :"<void column::put_volumn()
{cout<<"the volumn of the column is :"<<3.14*radius*radius*height<void main()
{circle m(5,1.2,1.0);
column n(4,4,0.2,0.3);
m.put_point();
m.put_radius();
m.put_area();
n.put_point();
n.put_area();
n.put_volumn();
}
第四道”根据Lab4第二小题定义”啥东东;
5答:
#include
class number
{public:
number(int=0);
virtual void show()=0;
protected:
int val;
};
number::number(int i)
{val=i;}

class output:public number
{public:
output(int=0);
void show();
};
output::output(int i):number(i){}
void output::show()
{cout<<"hex:"<
void main()
{output n(45);
n.show();}

7答:
#include
class point
{public:
point(double=0,double=0);
void put_point();
protected:
double x,y;
};
point::point(double i,double j)
{x=i;
y=j;}
void point::put_point();
{cout<<"the point of the center is"<<'('<
class ellipse:public point
{public:
ellipse(double=0,double=0,double=0,double=0);
void put_longside();
void put_shortside();
void put_expressions();
protected:
double a,b;
};
ellipse::ellipse(double m,double n,double i,double j):point(i,j)
{a=m;
b=n;
}
void ellipse::put_longside()
{cout<<"the longside of the ellipse is : "<<(a>b?a:b)<}
void ellipse::put_shortside()
{cout<<"the shortside of the ellipse is : "<<(a}
void ellipse::put_expressions()
{cout<<"the shortside of the ellipse is meet to the expressions : x*x/(a*a)+y*y/(b*b)=1 "<}

class rectangle:public point
{public:
rectangle(double=0,double=0,double=0,double=0);
void put_longth(){cout<<"the longth of the rectangle is: "<void put_width(){cout<<"the width of the rectangle is : "<void put_area();
protected:
double longth,width;
};
rectangle::rectangle(double l,double s,double i,double j):point(i,j)
{longth=l;
width=s;
}
void rectangle::area()
{cout<<"the area of the rectangle is : "<
class circle:public ellipse
{public:
circle(double=0,double=0,double=0,double=0);
void put_area(double,double);

protected:
double radius;
};
circle::circle(double m,double n,double i,double j):ellipse(m,n,i,j){}
void circle::put_area(a,b)
{if(a==b)
{radius=a;
cout<<"the radius of the circle is :"<cout<<"the area of the circle is : "<<3.14*radius*radius<else cout<<"it is a ellipse.the area is :"<<4*3.14*a*b<}

class square:public rectangle
{public:
square(double=0,double=0,double=0,double=0);
void put_area(double,double);
protected:
double side;
};
square::square(double m,double n,double i,double j):rectangle(m,n,i,j){}
void square::put_area(longth,width)
{if(longth==width)
{side=longth;
cout<<"the longth of the square is :"<cout<<"the area of the square is :"<else cout<<"It is a rectangle. the area is : "<}

void main()
{circle c1(2,1,5.0,2.0);
circle c2(1,1,2.0,2.0);
c1.put_point();
c1.put_area();
c2.put_point();
c2.put_area();
square s1(5,4,0.2,0.2);
square s2(6,6,1.0,2.0);
s1.put_point();
s1.put_area();
s2.put_point();
s2.put_area();
}

这一道我暂时没有时间给你调试,里面应会出现问题,不过很容易能解决的

不好意思,不太能帮到你,我是今晚才看到你的题目的,但我自已得做作业,所以有几道没能给你解决,如果是昨晚的话我就能帮你都做完

回答2:

不清楚,SORRY