-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoint.cpp
More file actions
66 lines (52 loc) · 970 Bytes
/
point.cpp
File metadata and controls
66 lines (52 loc) · 970 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "point.h"
point::point(float X, float Y)
{
x = X;
y = Y;
}
float point::getX()
{
return x;
}
float point::getY()
{
return y;
}
void point::setX(float X)
{
x = X;
}
void point::setY(float Y)
{
y = Y;
}
void point::operator=(const point& point)
{
x = point.x;
y = point.y;
}
bool point::operator==(const point& point)const
{
if (x == point.x && y == point.y)
return 1;
else
return 0;
}
point::point(const point& other)
: x(other.x), y(other.y) {}
std::ostream& operator<<(std::ostream& os, const point& p) {
os << "(" << p.x << "," << p.y << ")" << std::endl;
return os;
}
std::istream& operator>>(std::istream& input, point& Point)
{
std::cout << "\t\t\t\033[38;5;202mEnter x-coordinate:\033[0m";
std::cout << "\033[38;5;220m";
input >> Point.x;
std::cout << "\033[0m";
std::cout << "\t\t\t\033[38;5;202mEnter y-coordinate:\033[0m";
std::cout << "\033[38;5;220m";
input >> Point.y;
std::cout << "\033[0m";
return input;
}