blob: 100291ba9aedb892f73f1b0cc9a6e2288c38f47a (
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
|
#include <cmath>
#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() << ")";
};
|