#include<bits/stdc++.h>
#define IOF ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#define ll long long
#define pb public:
#define pr private:
using namespace std;
class Ccomplex{
float real , imag;
public:
void print(){
cout << real << (imag < 0 ? " - " : " + ") << abs(imag) << 'i' << '\n';
}
void setReal(float r){
real = r;
}
void setImag(float i){
imag = i;
}
float getReal(){
return real;
}
float getImag(){
return imag;
}
Ccomplex add(Ccomplex c){
Ccomplex tmp;
tmp.real = real + c.getReal();
tmp.imag = imag + c.getImag();
return tmp;
}
Ccomplex sub(Ccomplex c){
Ccomplex tmp;
tmp.real = real - c.getReal();
tmp.imag = imag - c.getImag();
return tmp;
}
};
int main() {
Ccomplex c1 , c2 , res;
c1.setImag(4) ;
c1.setReal(3);
c2.setImag(5) ;
c2.setReal(6);
c1.print();
c2.print();
res = c1.add(c2);
res.print();
res = c1.sub(c2);
res.print();
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBJT0YgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpLCBjaW4udGllKG51bGxwdHIpLCBjb3V0LnRpZShudWxscHRyKTsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBwYiBwdWJsaWM6CiNkZWZpbmUgcHIgcHJpdmF0ZToKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY2xhc3MgQ2NvbXBsZXh7CmZsb2F0IHJlYWwgLCBpbWFnOwogIHB1YmxpYzoKICB2b2lkIHByaW50KCl7CmNvdXQgPDwgcmVhbCA8PCAoaW1hZyA8IDAgPyAiIC0gIiA6ICIgKyAiKSA8PCBhYnMoaW1hZykgPDwgJ2knIDw8ICdcbic7CiAgfQogIHZvaWQgc2V0UmVhbChmbG9hdCByKXsKICByZWFsID0gcjsKfQp2b2lkIHNldEltYWcoZmxvYXQgaSl7CiBpbWFnID0gaTsKfQpmbG9hdCBnZXRSZWFsKCl7CnJldHVybiByZWFsOwp9CmZsb2F0IGdldEltYW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