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
|
||||||
@ -1,11 +1,15 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "atlas.h"
|
#include "atlas.h"
|
||||||
#include "worka.h"
|
#include "worka.h"
|
||||||
|
#include "workb.h"
|
||||||
|
#include "Circle.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
atlasPrint();
|
atlasPrint();
|
||||||
MyClass().Print();
|
MyClass().Print();
|
||||||
|
test().Print();
|
||||||
|
cout << Circle().Area() << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in new issue