2 u013300892 u013300892 于 2014.01.06 22:29 提问

有一个错误,大家帮忙看下

include

define PI 3.14

class shape
{
public:
virtual float area()=0;
virtual float girth()=0;
};
class circle:public shape
{
public:
circle(int a)
{
r=a;
}
float area()
{
s=PI*r*r;
return s;
}
float girth()
{
c=2*r*PI;
return c;
}
friend double operator + (circle &v,circle &d);
private:
int r;
float s,c;
};
double operator + (circle &q,circle &u)
{
return(q.area()+u.area());
}

void mianji(shape&b)
{
cout< }
void zhouchang(shape&c)
{
cout }
void mianji(shape *d)
{
coutarea()<<endl;
{
void main()
{
circle q(5),u(6),s(0);
cout<<"圆1的面积"<<endl;
mianji(q);
cout<<"圆2的面积"<<endl;
mianji(u);
s=q+u;
mianji(s);
cout<<"圆的周长"<<endl;
zhouchang(q);

}

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!