运算符重载 1、 实验目的和要求: 掌握运算符重载的语法要点,学会运算符重载的编程方法。 2、 实验内容 (1) 先读程序,写出程序的输出结果,再运行程序验证程序的输出。用友元重载方式重新编写程序。 #include using namespace std; class Vector { public: Vector(int i = 0,int j = 0) {x=i;y=j;} Vector operator+=(Vector v) { Vector temp; temp.x = x+v.x; temp.y = y+v.y; return temp; } Vector operator-=(Vector v) { Vector temp( x-v.x, y-v.y); return temp; } void display() { cout<<"("< using namespace std; class Vector { public: Vector(int i = 0,int j = 0) { x=i; y=j; } friend Vector operator+=(Vector &v1,Vector &v2) { v1.x+=v2.x; v1.y+=v2.y; return v1; } friend Vector operator-=(Vector &v1,Vector &v2) { v1.x=v1.x-v2.x; v1.y=v1.y-v2.y; return Vector( v1.x, v1.y); } void display() { cout<<"("< class Rational { public: Rational(int nn=1,int mm=1); void print(); void simple(); Rational operator+(Rational & a);...