#include <stdio.h>

typedef struct {
	double Re; /** 実部 **/
	double Im; /** 虚部 **/
} Complex;

int input(Complex *z)
{
	printf("Re Im=");
	scanf("%lf %lf", &z->Re, &z->Im);
	return 0;
}

Complex wa(Complex z1, Complex z2)
{
	Complex	z;

	z.Re = z1.Re + z2.Re;
	z.Im = z1.Im + z2.Im;
	return z;
}

Complex seki(Complex z1, Complex z2)
{
	Complex	z;

	z.Re = (z1.Re * z2.Re) - (z1.Im * z2.Im);
	z.Im = (z2.Re * z1.Im) + (z1.Re * z2.Im);
	return z;
}

int main()
{
	Complex	z1, z2, z;

	printf("z1\n");
	input(&z1);
	printf("z2\n");
	input(&z2);
	z = wa(z1, z2);
	printf("z1+z2 Re=%f Im=%f\n", z.Re, z.Im);
	z = seki(z1, z2);
	printf("z1+z2 Re=%f Im=%f\n", z.Re, z.Im);
	return 0;
}
