注意:本题输出形式a+bi或则a-bi
注意b>0,b=0,b<0,a==0的情况
#include<bits/stdc++.h>
using namespace std;
const int MAXSIZE=1001;
struct E {
int x,y;
E(int x,int y):x(x),y(y) {
}
E operator +(const E &a)const {
return E(a.x+x,a.y+y);
}
};
int main() {
int n,x1,x2,y1,y2;
cin>>n;
while(n--) {
cin>>x1>>y1>>x2>>y2;
E a=E(x1,y1);
E b=E(x2,y2);
E c=a+b;
if(c.y>0) {
if(c.x!=0)
cout<<c.x<<"+"<<c.y<<"i"<<endl;
else
cout<<c.y<<"i"<<endl;
} else if(c.y<0) {
if(c.x!=0)
cout<<c.x<<c.y<<"i"<<endl;
else
cout<<c.y<<"i"<<endl;
} else {
cout<<c.x<<endl;
}
}
return 0;
}