标签:des blog io os sp 数据 div 2014 on
2 3 4 3 5 3 4 3 1 5 4 3
6 6 5 8 9 6
#include <iostream> using namespace std; class position { private: int x1,x2,x3; int y1,y2,y3; public: position(int a=0,int b=0,int c=0,int d=0,int e=0,int f=0) { x1=a; x2=b; x3=c; y1=d; y2=e; y3=f; } position operator +(position & r); friend ostream&operator <<(ostream&, position&); }; position position :: operator +(position & r) { position p; p.x1=x1+r.x1; p.x2=x2+r.x2; p.x3=x3+r.x3; p.y1=y1+r.y1; p.y2=y2+r.y2; p.y3=y3+r.y3; return p; } ostream & operator << (ostream & output, position &r) { output<<r.x1<<" "<<r.x2<<" "<<r.x3<<endl; output<<r.y1<<" "<<r.y2<<" "<<r.y3; return output; } int main() { int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f; position r1(a,b,c,d,e,f); cin>>a>>b>>c>>d>>e>>f; position r2(a,b,c,d,e,f); position r3; r3=r1+r2; cout<<r3<<endl; return 0; }
标签:des blog io os sp 数据 div 2014 on
原文地址:http://blog.csdn.net/u013634961/article/details/40214605