主题:初学不明白
#include<iostream>
using namespace std;
class Circle
{
public:Circle(float radius)
{Radius=radius;};
GetArea();
private:float Radius;
};
int Circle::GetArea(){return 3.1415*Radius*Radius;};
int main()
{ float Radius;
cout<<"输入半径";
cin>>Radius;
Circle a(Radius);
cout<<"面积为:"<<a.GetArea;
}
为什么输入多少结果都是1,高手不要见笑!!!!!
using namespace std;
class Circle
{
public:Circle(float radius)
{Radius=radius;};
GetArea();
private:float Radius;
};
int Circle::GetArea(){return 3.1415*Radius*Radius;};
int main()
{ float Radius;
cout<<"输入半径";
cin>>Radius;
Circle a(Radius);
cout<<"面积为:"<<a.GetArea;
}
为什么输入多少结果都是1,高手不要见笑!!!!!