#include<iostream>
using namespace std;
class Add {
private:
int x, y;
public:
Add(int aa = 0, int bb = 0) {
x = aa;
y = bb;
}
void display();
friend Add operator+(Add &t1, Add &t2);
friend Add operator-(Add &t1, Add &t2);
};
Add operator+(Add &t1, Add &t2)
{
return (t1.x + t2.x, t1.y + t2.y);
}
Add operator-(Add &t1, Add &t2)
{
return (t1.x - t2.x, t1.y - t2.y);
}
void Add::display()
{
cout << "(" << x << "," << y << ")" << endl;
}
int main()
{
Add t1(1, 2);
Add t2(3, 4);
Add t3, t4;
t3 = t1 + t2;
t4 = t2 - t1;
t3.display();
t4.display();
system("pause");
return 0;
}
#include<iostream>
using namespace std;
class Out {
private:
int x;
int y;
public:
Out(int aa = 0, int bb = 0)
{
x = aa;
y = bb;
}
friend ostream& operator<<(ostream& os, const Out& a)
{
os << "(" << a.x << "," << a.y << 'i' << ")" << endl;
return os;
}
friend istream& operator >> (istream& is, Out& a)
{
is >>a.x >> a.y;
return is;
}
};
int main()
{
Out t1;
cin>>t1;
cout << t1;
system("pause");
return 0;
}