You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
377 B
38 lines
377 B
#ifndef CIRCLE_H
|
|
#define CIRCLE_H
|
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
#define PI 3.14
|
|
|
|
class Circle
|
|
{
|
|
private:
|
|
double r;//半径
|
|
public:
|
|
Circle();//构造函数
|
|
Circle(double R);//构造函数
|
|
double Area();//求面积函数
|
|
};
|
|
|
|
Circle::Circle()
|
|
{
|
|
this->r=5.0;
|
|
}
|
|
|
|
Circle::Circle(double R)
|
|
{
|
|
this->r=R;
|
|
}
|
|
|
|
double Circle::Area()
|
|
{
|
|
return PI*r*r;
|
|
|
|
}
|
|
|
|
|
|
#endif
|