为了账号安全,请及时绑定邮箱和手机立即绑定

getsurface,还有getvolume函数应该怎么写?求大神帮忙解答,谢谢!!

getsurface,还有getvolume函数应该怎么写?求大神帮忙解答,谢谢!!

C++
someOne_forward 2016-05-16 16:17:06
 #include<iostream>using namespace std;class container{   protected:   double radius;   public:  container(double radiusl);           virtual double surdface_area()=0;           virtual double volume()=0;};class cube:public container{public: cube(double l):container(l) {length=l;} double surdface_area() {return 6*length*length;} double volume() {return length*length*length;}protected:double length;};class spherre:public container{public: spherre(double r):container(r) {Radius=r;} double surdface_area() {return 4*3.14*Radius*Radius;} double volume() {return 4/3*3.14*Radius*Radius;}protected: double Radius;};class cylinder:public container{public: cylinder(double r,double h):container(r) {Radius=r; High=h; }double surdface_area(){return 2*3.14*Radius*Radius+2*3.14*Radius*High;} double volume() {return 3.14*Radius*Radius*High;}protected: double Radius; double High;};void getSurface_area(){}void getVolume(){}void main (){ container *p[3];p[0]= new cube(6); p[1]=new spherre (5);  p[2]=new cylinder(5,6);for (int i=0;i<3;i++)cout<<"表面积为"<<getSurface_area(p[i]) <<",体积为"<<getVolume(p[i])<<endl;}问题是:'getVolume' : function does not take 1 parameterserror C2660: 'getSurface_area' : function does not take 1 parameters 
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 1921 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信