<pre name="code" class="html">#include<iostream>
using namespace std;
class Circle
{
public:
Circle(double r=0.0)
{
radius=r;
}
double area()
{
return radius*radius*3.14;
}
void input();
private:
double radius;
};
void Circle::input()
{
cout<<"please input radius:"<<endl;
cin>>radius;
}
int main()
{
Circle r1;
r1.input();
cout<<"the area of circle:"<<r1.area()<<endl;
return 0;
}
作业3.22
最新推荐文章于 2021-02-27 11:02:50 发布