-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0004.cpp
48 lines (46 loc) · 833 Bytes
/
0004.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
#include <iostream>
using namespace std;
class A {
public:
// 在此处补充你的代码
int _a;
A(int a):_a(a){}
friend ostream& operator<<(ostream& os,const A& a){
os<<a._a;
return os;
}
A& operator+=(const A& a){
_a += a._a;
return *this;
}
A& operator-=(const A& a){
_a -= a._a;
return *this;
}
A& operator-=(int a){
_a -= a;
return *this;
}
// int getValue(void){
// return _a;
// }
A& getValue(void){
return *this;
}
};
int main() {
int t;
cin >> t;
while(t-- ) {
int m,n,k;
cin >> m >> n >> k;
A a(m);
A b = a;
cout << b << endl;
cout << (a += b -= n) << endl;
cout << a.getValue() << endl;
a.getValue() = k;
cout << a << endl;
}
return 0;
}