-
Notifications
You must be signed in to change notification settings - Fork 549
/
Copy path15_04.cpp
54 lines (44 loc) · 1.01 KB
/
15_04.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
47
48
49
50
51
52
53
54
#include <bits/stdc++.h>
using namespace std;
class MyPair {
private:
int first, second;
public:
MyPair() : // Empty constructor to allow using default
first(-1), second(-1) {
}
MyPair(int first, int second) :
first(first), second(second) {
}
void print() {
cout << "(" << first << "," << second << ")\n";
}
int GetFirst() const {
return first;
}
void SetFirst(int first) {
this->first = first;
}
int GetSecond() const {
return second;
}
void SetSecond(int second) {
this->second = second;
}
friend istream & operator >>(istream &input, MyPair &pair);
friend ostream & operator <<(ostream &output, const MyPair &pair);
};
istream& operator >>(istream &input, MyPair &pair) {
input >> pair.first >> pair.second;
return input;
}
ostream& operator <<(ostream &output, const MyPair &pair) {
output << "("<<pair.first << " "<<pair.second << ")\n";
return output;
}
int main() {
MyPair x, y;
cin >> x >> y;
cout << x << y;
return 0;
}