freopen with oop
#include<bits/stdc++.h>
using namespace std;
class marks
{
int x,y;
public:
marks(){}
marks(int a,int b)
{
x=a;
y=b;
}
void show()
{
cout<<x<<" "<<y<<endl;
}
marks operator+(marks s)
{
marks temp;
temp.x=x+s.x;
temp.y=y+s.y;
return temp;
}
};
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int p,q,r,s;
cin>>p>>q>>r>>s;
marks m1(p,q),m2(r,s),m3;
m1.show();
m2.show();
m3=m1+m2;
m3.show();
return 0;
}
0 Comments