#include <stdio.h>
#include <math.h>
#include<iostream>
using namespace std;
class complex {
private:
double re,im;
public:
complex(double=0,double=0);
complex(const complex &);
//complex operator+(const complex &)const;
friend complex operator+(const complex &,const complex &);
complex & operator=(const complex &);
void print();
void set(double=0,double=0);
friend ostream & operator<<( ostream &, const complex &);
friend complex operator++(complex &);
};
complex::complex(double r,double i){ re=r; im=i; }
complex::complex(const complex &b){re=b.re; im=b.im; }
/*
complex complex::operator+(const complex &b)const{
complex t;
t.re=re+b.re; t.im=im+b.im; return t; }
*/
complex operator+(const complex & a, const complex &b){
complex t;
t.re=a.re+b.re; t.im=a.im+b.im; return t;}
complex & complex::operator=(const complex & b){re=b.re; im=b.im; return *this; }
void complex::print(){ printf("(%5.2f,%5.2f)",re,im); }
void complex::set(double r,double i){ re=r; im=i; }
ostream & operator<<(ostream & a, const complex & b){
a<<"("<<b.re<<","<<b.im<<")"; return a; }

complex operator++(complex & a){
a.re=a.re+1; return a;    }

void main(){
complex a(2,2),b(1),c;
c=a+b;
printf("c="); c.print();
int d=5;
cout<<d;
c=d+a;
//c.print();
cout<<c;
++a;
cout<<"\na="<<a;
}