diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2023-01-12 23:40:59 -0500 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2023-01-12 23:40:59 -0500 |
commit | b4f16386c70bfeab700e7cc129f2f04295aa0059 (patch) | |
tree | 8211e50bdf4f22eed2d2f2a19166e3a6f4ae5155 /cercle.cpp | |
parent | 0ef3e40f726f35b86d79426104234d815cea2bb9 (diff) |
vecteur est fomrmes sont finis
Diffstat (limited to 'cercle.cpp')
-rw-r--r-- | cercle.cpp | 43 |
1 files changed, 25 insertions, 18 deletions
@@ -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"; }; |