-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoordinate.cpp
More file actions
30 lines (26 loc) · 780 Bytes
/
coordinate.cpp
File metadata and controls
30 lines (26 loc) · 780 Bytes
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
#include "coordinate.h"
coordinate::coordinate() :x_y{ 0 } {}
coordinate::coordinate(float* point) {
x_y[0] = point[0];
x_y[1] = point[1];
}
float* coordinate::set_get_xy() { return x_y; }
istream& operator>>(istream& in, coordinate& point) {
cout << "\t\t\t\t\tX:";
in >> point.x_y[0];
cout << "\t\t\t\t\tY:";
in >> point.x_y[1];
return in;
};
ostream& operator<<(ostream& out, const coordinate& point) {
cout << "("<< point.x_y[0]<<","<<point.x_y[1]<<")";
return out;
};
coordinate* coordinate::operator=(const coordinate& secondPoint) {
x_y[0] = secondPoint.x_y[0];
x_y[1] = secondPoint.x_y[1];
return this;
}
bool coordinate::operator==(const coordinate& secondPoint) const {
return this->x_y[0] == secondPoint.x_y[0] && this->x_y[1] == secondPoint.x_y[1];
}