From b4f16386c70bfeab700e7cc129f2f04295aa0059 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Thu, 12 Jan 2023 23:40:59 -0500 Subject: vecteur est fomrmes sont finis --- cercle.cpp | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'cercle.cpp') diff --git a/cercle.cpp b/cercle.cpp index 100291b..4747258 100644 --- a/cercle.cpp +++ b/cercle.cpp @@ -1,27 +1,34 @@ -#include -#include "forme.h" +#include "cercle.h" +#include -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"; }; -- cgit v1.2.3