-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathCircle.h
54 lines (43 loc) · 1 KB
/
Circle.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef CIRClE_H
#define CIRCLE_H
#include <iostream>
#include <fstream>
class Circle{
public: Circle(){values[0]=values[1]=values[2]=0.0;}
Circle(double _posX, double _posY, double _radius){
values[0]=_posX;
values[1]=_posY;
values[2]=_radius;
}
void SetPos(double _x, double _y){
values[0] = _x;
values[1] = _y;
}
void SetPos(std::pair<double,double> _pos){
values[0] = _pos.first;
values[1] = _pos.second;
}
void SetRadius(double _radius){
values[2] = _radius;
}
std::pair<double,double> GetPos() const{
return std::make_pair(values[0],values[1]);
}
double GetX() const {
return values[0];
}
double GetY() const{
return values[1];
}
double GetRadius() const{
return values[2];
}
friend std::ostream& operator<< (std::ostream& fout, const Circle& lhs){
fout << "Circle at point: (" << lhs.values[0] << ", " << lhs.values[1] << ") with radius = " <<
lhs.values[2] << std::endl;
return fout;
}//end overloaded output operator
private:
double values[3];
};
#endif