: cannot convert parameter 1 from ✀int✀ to ✀const class SimpleCircle &✀

2024-11-25 14:20:03
推荐回答(2个)
回答1:

#include
using namespace std;
const int p=3;
class SimpleCircle
{
public:
SimpleCircle();
SimpleCircle(int r1):radius(r1){} //定义一个有参构造函数
int circleference();
int area();
private:
int radius;
};
SimpleCircle::SimpleCircle()
{
}
int SimpleCircle::circleference()
{
return 2*p*radius;
}
int SimpleCircle::area()
{
return p*radius*radius;
}
void main()
{
int radius;
cout<<"please put in the radius"< cin>>radius;
SimpleCircle a(radius); //少了分号
SimpleCircle*itsradius;
itsradius=&a;
cout<<"circleference is:"<circleference()< cout<<"circle area is:"<area()<}

回答2:

抱歉,看不懂呀!