From 0ef3e40f726f35b86d79426104234d815cea2bb9 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Tue, 10 Jan 2023 10:28:41 -0500 Subject: Start working on shapes --- cercle.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 cercle.cpp (limited to 'cercle.cpp') diff --git a/cercle.cpp b/cercle.cpp new file mode 100644 index 0000000..100291b --- /dev/null +++ b/cercle.cpp @@ -0,0 +1,27 @@ +#include +#include "forme.h" + +class Cercle:Forme { + private: + int Rayon; + public: + + Cercle(int x, int y, int r):Forme(x,y),Rayon(r) { + Coordonnee t = {x,y}; + setAncrage(t); + SetRayon(r); + + }; + + 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;}; +}; + +void Cercle::afficher(ostream & s) { + s << "Cercle (x=" << getAncrage().x + << ", y=" << getAncrage().y + << ", r=" << GetRayon() << ", aire=" << aire() << ")"; +}; -- cgit v1.2.3