summaryrefslogtreecommitdiff
path: root/cercle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cercle.cpp')
-rw-r--r--cercle.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/cercle.cpp b/cercle.cpp
index 100291b..4747258 100644
--- a/cercle.cpp
+++ b/cercle.cpp
@@ -1,27 +1,34 @@
-#include <cmath>
-#include "forme.h"
+#include "cercle.h"
+#include <math.h>
-class Cercle:Forme {
- private:
- int Rayon;
- public:
+Cercle::Cercle(int x, int y, int r):Forme(x,y) {
+ Coordonnee xy = {x,y};
+ setAncrage(xy);
+ setRayon(r);
+};
+
+Cercle::~Cercle() {
+};
- Cercle(int x, int y, int r):Forme(x,y),Rayon(r) {
- Coordonnee t = {x,y};
- setAncrage(t);
- SetRayon(r);
+void Cercle::setRayon(int r) {
+ rayon = r;
+};
- };
+int Cercle::getRayon() {
+ return rayon;
+};
+
+double Cercle::getAire() {
+ return M_PI*pow(rayon,2);
+};
- void afficher(ostream & s);
- int GetRayon(){return Rayon;};
- void SetRayon(int r){Rayon=r;};
- double aire(){return M_PI*Rayon*Rayon;};
- double perimetre(){return 2*M_PI*Rayon;};
+double Cercle::getPerimetre() {
+ return 2*M_PI*rayon;
};
void Cercle::afficher(ostream & s) {
s << "Cercle (x=" << getAncrage().x
- << ", y=" << getAncrage().y
- << ", r=" << GetRayon() << ", aire=" << aire() << ")";
+ << ", y=" << getAncrage().y
+ << ", r=" << getRayon()
+ << ", aire=" << getAire() << ")\n";
};