diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2023-01-13 19:37:56 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2023-01-13 19:37:56 -0500 |
commit | 6a20ac2049d7e9fbf827838259911bf0899f46d9 (patch) | |
tree | 4b96dfc05bbd03da1d80bd2369b339dac5041c10 /cercle.cpp | |
parent | bd3b390064aa8dee26845dc6fcc1b5d79773a167 (diff) | |
parent | 86fbed0811fc4ef36ffb66b3f774df61eb87c24b (diff) |
Fix gitignore merge
Diffstat (limited to 'cercle.cpp')
-rw-r--r-- | cercle.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cercle.cpp b/cercle.cpp new file mode 100644 index 0000000..bd3c876 --- /dev/null +++ b/cercle.cpp @@ -0,0 +1,32 @@ +#include "cercle.h" +#include <math.h> + +Cercle::Cercle(int x, int y, int r):Forme(x,y) { + setRayon(r); +}; + +Cercle::~Cercle() { +}; + +void Cercle::setRayon(int r) { + rayon = r; +}; + +int Cercle::getRayon() { + return rayon; +}; + +double Cercle::aire() { + return M_PI*pow(rayon,2); +}; + +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() << ")\n"; +}; |