#include<iostream> using namespace std; class Complex { public: double a,b; Complex(double a,double b)//构造函数 { this->a = a; this->b = b; } Complex operator+=(Complex temp)//我重载的是+=,个人喜好 { this->a += temp.a; this->b += temp.b; return Complex(this->a,this->b); } Complex operator-(Complex temp) { this->a -= temp.a; this->b -= temp.b; return Complex(this->a,this->b); } void cal() { if(this->b >= 0) cout << this->a << "+" << this->b << "i" << endl; else cout << this->a << this->b << "i" << endl; } ~Complex(){}//析构函数 }; int main(void) { int m; while(cin >> m) { while(m--) { double a_1,b_1,a_2,b_2; cin >> a_1 >> b_1 >> a_2 >> b_2; Complex x(a_1,b_1); Complex y(a_2,b_2); x += y; x.cal(); } } return 0; }