1个回答
展开全部
#include <cmath>
class Circle
{
public:
Circle():radius(0){}
Circle(double r):radius(r){}
const double area() const
{
return M_PI * radius * radius;
}
const double perimeter() const
{
return 2 * M_PI * radius;
}
friend double area(Circle);
friend double perimeter(Circle);
private:
double radius;
};
double area(Circle c)
{
return M_PI * c.radius * c.radius;
}
double perimeter(Circle c)
{
return 2 * M_PI * c.radius;
}
class Circle
{
public:
Circle():radius(0){}
Circle(double r):radius(r){}
const double area() const
{
return M_PI * radius * radius;
}
const double perimeter() const
{
return 2 * M_PI * radius;
}
friend double area(Circle);
friend double perimeter(Circle);
private:
double radius;
};
double area(Circle c)
{
return M_PI * c.radius * c.radius;
}
double perimeter(Circle c)
{
return 2 * M_PI * c.radius;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |