/*001*/ #ifndef __COMPLEX__
/*002*/ #define __COMPLEX__
/*037*/ #include <iostream.h>
/*004*/ class complex{
/*008*/ public:
/*009*/ complex (double r = 0, double i = 0)
/*010*/ : re(r), im(i) {}
/*011*/ double real () const { return re; }
/*012*/ double imag () const { return im; }
/*013*/ complex& operator += (const complex&);
/*006*/ private:
/*007*/ double re, im;
/*017*/ friend complex& __doapl(complex*, const complex&);
/*005*/ }
/*003*/ #endif
/*018*/ inline complex&
/*014*/ complex::operator += (const complex& r){
/*016*/ return __doapl(this, r);
/*015*/ }
/*024*/ inline complex&
/*019*/ __doapl(complex* ths, const complex& r){
/*021*/ ths->re += r.re;
/*022*/ ths->rm =+ r.im;
/*023*/ return *ths;
/*020*/ }
/*037*/ inline double
/*034*/ imag (const complex& x){
/*036*/ return x.imag ();
/*035*/ }
/*041*/ inline double
/*038*/ real (const complex& x){
/*040*/ return x.real ();
/*039*/ }
/*027*/ inline complex
/*025*/ operator + (const complex& x, const complex& y){
/*042*/ return complex (real(x) + real(y), imag(x) + imag(y));
/*026*/ }
/*030*/ inline complex
/*028*/ operator + (const complex& x, double y){
/*043*/ return complex (real(x) + y, imag(x));
/*029*/ }
/*033*/ inline complex
/*031*/ operator + (double x, const complex& y){
/*044*/ return complex (x + real(y), imag(y));
/*032*/ }
/*047*/ inline ostream&
/*045*/ operator << (ostream& os, const complex& x){
/*048*/ return os << '(' << real(x) << ',' << imag(x) << ')';
/*046*/ }
/*001*/ /*002*/ /*003*/ 防卫声明
/*004*/ /*005*/ class head
/*006*/ /*007*/ 数据放在private(without poniter)
/*008*/ /*009*/ /*010*/ 构造函数 无返回值 默认参数 初始化列表 拷贝构造/拷贝赋值编译期自动生成且可用故不写
/*011*/ /*012*/ 成员函数(常成员函数) 自动内联 pass by value/reference 都行
/*013*/-------- /*024*/ 操作符重载(成员函数,带this) 友元
/*025*/-------- /*044*/ 操作符重载(非成员函数,无this) 临时对象 return by value
`` `