Compare commits
3 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b5a61ec98c | 6 years ago |
|
|
2348717c64 | 6 years ago |
|
|
2809219b1f | 6 years ago |
@ -0,0 +1,37 @@
|
||||
#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
|
||||
Loading…
Reference in new issue