static void Main(string[] args) { Complex a, b; a.im = 1; a.re = 2; b.im = 3; b.re = 1; Complex z = a.Minus(b); Complex m = a.Multi(b); Console.WriteLine(z.ToString()); Console.WriteLine(m.ToString()); Complex_class x; x = new Complex_class(3, 5); Complex_class y = new Complex_class(11, -4); y.Im = -10; Complex_class res; res = x.Plus(y); Console.WriteLine(res.ToString()); }
public Complex_class Multi(Complex_class x) { Complex_class z = new Complex_class(); z.im = im * x.im + re * x.im; z.re = re * x.im - im * x.re; return(z); }
public Complex_class Minus(Complex_class x) { Complex_class z = new Complex_class(); z.im = im - x.im; z.re = re - x.re; return(z); }
public Complex_class Plus(Complex_class x) { Complex_class z = new Complex_class(); z.im = im + x.im; z.re = re + x.re; return(z); }