blob: d2e7f61f2a4a75dcc1c8c21a14c9f6021f0538ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "cercle.h"
#include <math.h>
Cercle::Cercle(int x, int y, int r):Forme(x,y) {
Coordonnee xy = {x,y};
setAncrage(xy);
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";
};
|