-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzPoint.cpp
46 lines (39 loc) · 810 Bytes
/
zPoint.cpp
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
#include "Point.h"
#include "zPoint.h"
#include "iostream"
zPoint::zPoint(double initialX, double initialY, double initialZ)
{
X = initialX;
Y = initialY;
Z = initialZ;
}
void zPoint::set_z(double newZ)
{
Z = newZ;
}
double zPoint::get_z()
{
return Z;
}
std::ostream& operator<<(std::ostream& os, zPoint& pt)
{
os << "(" << pt.get_x() << ", " << pt.get_y() << ", " << pt.get_z() << ")";
return os;
}
bool operator== (zPoint &p1, zPoint &p2)
{
return (p1.get_x()== p2.get_x() &&
p1.get_y()== p2.get_y() &&
p1.get_z()== p2.get_z());
}
bool operator!= (zPoint &p1, zPoint &p2)
{
return !(p1== p2);
};
zPoint operator+= (zPoint &p1, zPoint &p2)
{
p1.set_x(p1.get_x() + p2.get_x());
p1.set_y(p1.get_y() + p2.get_y());
p1.set_z(p1.get_z() + p2.get_z());
return p1;
}