#include <math.h>
#include <stdio.h>

struct str_complex {
private:
    double re, im;
public:
    str_complex(double a_re, double a_im) { re = a_re; im = a_im; }
    double distance(const str_complex *other)
    {
        double dre = re - other->re;
        double dim = im - other->im;
        return sqrt(dre * dre + dim * dim);
    }
    void add(const str_complex *other) { re += other->re; im += other->im; }
    void print() { printf("%g%+gi\n", re, im); }
};

int main()
{
    str_complex a(1, 2), b(4, 6);

    printf("%f\n", a.distance(&b));
    a.add(&b);
    a.print();
    return 0;
}
