1个回答
2013-10-17
展开全部
class CVector{private:int a,b,c;public:CVector(int A,int B,int C):a(A),b(B),c(C){};~CVecotr(){};friend CVector operator+(const CVector& left,const CVector& right);friend CVector operator-(const CVector& left,const CVecor& right);friend ostream& operator<<(ostream& out,const CVector& right);};CVector operator+(const CVector& left,const CVector& right){return CVector(left.a+right.a,left.b+right.b,left.c+right.c);}CVector operator-(const CVector& left,const CVector& right){return CVector(left.a-right.a,left.b-right.b,left.c-right.c);}ostream& operator<<(ostream& out,const CVector& right){return out<<right.a<<right.b<<right.c<<endl;}基本模型大概就这样了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询